Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Revit Design Automation | Extensible Storage "Writing of Entities of this Schema is not allowed to the current add-in." Error

tristan-m
Participant

Revit Design Automation | Extensible Storage "Writing of Entities of this Schema is not allowed to the current add-in." Error

tristan-m
Participant
Participant

I have been using Extensible Storage in my addin for quite some time with no problems. Here is a simple example of the schema creation:

 

SchemaBuilder schemaBuilder = new SchemaBuilder(schemaGuid);
schemaBuilder.SetReadAccessLevel(AccessLevel.Public);
schemaBuilder.SetWriteAccessLevel(AccessLevel.Vendor);
schemaBuilder.SetVendorId("myVendorId");
schemaBuilder.SetSchemaName("DataStorageUniqueId");
schemaBuilder.AddSimpleField("Id", typeof(Guid));
return schemaBuilder.Finish(); 

 


I also have an APS addin, and recently decided to use the same Extensible Storage code inside the APS addin. Both addin files have the same vendorId.

When I create the extensible storage in my Revit Addin locally, there are no issues. When I run the same code to create a schema and create the entity in my Revit APS Addin, I get the following error: Autodesk.Revit.Exceptions.InvalidOperationException: Writing of Entities of this Schema is not allowed to the current add-in.

After loads of testing on this trying to figure out the solution, I've come up with nothing. The only thing that works is setting the write access to Public instead of Vendor. This would however mess up my schema (hence breaking all previous models with that schema), so this is not an option. 

My theory to why this is a problem is that the VendorId being read is the Design Automation addin VendorId, not my addin's vendorId. I don't know an easy way to prove this, but at least wanted to throw it out there as a potential issue. 

Any theories or solutions to this problem? I found one previous post on StackOverflow about this that went unsolved. 

0 Likes
Reply
1,292 Views
12 Replies
Replies (12)

jeremy_tammik
Autodesk
Autodesk

Oh dear, that sounds serious. I am surprised I have not heard of it before. Your analysis sounds pretty convincing to me. Unfortunately, this forum is more directed towards the Revit .NET API on the Windows desktop, so I am not really the proper person to deal with the issue. However, I will gladly point it out to my colleagues and ensure that it receives the attention it deserves.. The better place to discuss this kind of pure DA4R issue via the APS help channels on StackOverflow, such as the unanswered threads you refer to.  Could you point out a few of those, so that I can add them to the list and ensure they are attended to as well? Thank you!

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

jeremy_tammik
Autodesk
Autodesk

Here is a personal note to myself with the link to the internal issue I raised with the team.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

tristan-m
Participant
Participant

Here is the only other reference I can find to this issue (wonder if you remember responding to this 3 years ago!):
https://stackoverflow.com/questions/64116854/unable-to-read-schema-from-extensible-storage-using-des...

I have posted this question to APS's StackOverflow as well, I will link when its published. 

0 Likes

jeremy_tammik
Autodesk
Autodesk

Thank you for the additional link. Oh dear, that thread terminated after I asked for a reproducible case.

  

I am afraid that we have reached the exact same point here as well.

  

The development team replied to my (your) query and say:

  

This is something we should look into. However, it looks like it deserves some significant investigation. Can you provide a complete minimal reproducible case for us to look at? Thank you!

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

ricaun
Advisor
Advisor

@tristan-m wrote:

My theory to why this is a problem is that the VendorId being read is the Design Automation addin VendorId, not my addin's vendorId. I don't know an easy way to prove this, but at least wanted to throw it out there as a potential issue.


Interesting... I don't believe the Design Automation have a VendorId, in the end Design Automation loads your .addin file in a similar way like in the Revit for desktop.

 

And in the Revit API if you look in the ActiveAddInId when running in the DA4R should show your addin name.

 

The Schema have this two method ReadAccessGranted and WriteAccessGranted with some description like:

"Checks whether Entities of this Schema may be retrieved by the current add-in. "

 

Pretty sure if the current addin have a different vendor id the schema gonna complain.

 

Now if DA is ignoring the VendorId in the .addin file, could create this problem.

 

I could create a unit test to learn how this vendor id works in Design Automation with Extensible Storage.

 

What version of the Revit are you using in DA4R?

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes

tristan-m
Participant
Participant

This issue occurred in every Revit engine from 2021-2024 in DA4R, I tested this with every version and had the same error every time. 

0 Likes

ricaun
Advisor
Advisor

I was wrong, looks like the ActiveAddInId is null inside design automation, this means the addin does not have a VendorId to compare with the Schema. Looks like Extensible Storage has some limitation in DA4R.

 

Here is a really long video about ExtensibleStorage Tests and Design Automation in the end.

 

 

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes

ricaun
Advisor
Advisor

A sample to show what is probably creating the issue.

 

  • Inside the OnStartup the ActiveAddInId is valid and show the name of the Addin. (Everything normal here.)
  • Inside the DesignAutomationReadyEvent event the ActiveAddInId is null meaning any method that require the reference of the the VendorId/ApplicationGuid gonna have some issue, the DA only Succeeded if ActiveAddInId is not null in the sample. (Never happens.)

 

public class App : IExternalDBApplication
{
    public ExternalDBApplicationResult OnStartup(ControlledApplication application)
    {
        Console.WriteLine("----------------------------------------");
        Console.WriteLine($"AddInId: \t{application.ActiveAddInId?.GetAddInName()}");
        Console.WriteLine("----------------------------------------");

        DesignAutomationBridge.DesignAutomationReadyEvent += DesignAutomationBridge_DesignAutomationReadyEvent;
        return ExternalDBApplicationResult.Succeeded;
    }

    public ExternalDBApplicationResult OnShutdown(ControlledApplication application)
    {
        DesignAutomationBridge.DesignAutomationReadyEvent -= DesignAutomationBridge_DesignAutomationReadyEvent;
        return ExternalDBApplicationResult.Succeeded;
    }

    private void DesignAutomationBridge_DesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e)
    {
        DesignAutomationBridge.DesignAutomationReadyEvent -= DesignAutomationBridge_DesignAutomationReadyEvent;

        var data = e.DesignAutomationData;
        var application = data.RevitApp;

        Console.WriteLine("----------------------------------------");
        Console.WriteLine($"AddInId: \t{application.ActiveAddInId?.GetAddInName()}");
        Console.WriteLine("----------------------------------------");

        e.Succeeded = application.ActiveAddInId != null;
    }
}

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

jeremy_tammik
Autodesk
Autodesk

Wow, thank you very much for your careful analysis and documentation. I shared your results with the development team as well. Happy Sunday (from my point of view).

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open

jeremy_tammik
Autodesk
Autodesk

Thank you for raising this serious issue, to ricaun for the careful analysis and documentation, and for your patience while I discussed it with the development team. Sorry to hear about this.

 

I logged the issue RVTDA-2070 [Cannot use Extensible Storage VendorId in APS Design Automation for Revit] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is crucial. Our engineering team has limited resources and must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Best regards,

 

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open

jeremy_tammik
Autodesk
Autodesk

Thank you again for reporting this and your patience while it is being addressed. Initial analysis completed, RVTDA-2070 [Cannot use Extensible Storage VendorId in APS Design Automation for Revit] has now been closed and a new ticket RVTDA-2073 [Cannot use Extensible Storage VendorId in APS Design Automation for Revit] opened in order to implement a fix. Please make a note of this number for future reference.

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open

ricaun
Advisor
Advisor

@tristan-m I found a way to make the ActiveAddInId valid in the Design Automation Ready event.

 

You can create a custom ExternalSevice and register in the OnStartup and make the Design Automation Ready event to execute your custom ExternalSevice, the code inside the ExternalSevice is execute in the same AddIn Context.

 

I created a library to make easier to use DA4R and fix this issue by default.

 

This is how the sample to check if the ActiveAddInId is not null in the DA4R event. In the code below the Execute method.

public class App : DesignApplication
{
    public override void OnStartup() 
    {
        Console.WriteLine("----------------------------------------");
        Console.WriteLine($"AddInId: \t{ControlledApplication.ActiveAddInId?.GetAddInName()}");
        Console.WriteLine("----------------------------------------");
    }

    public override void OnShutdown() 
    { 
    }

    public bool Execute(Application application, string filePath, Document document)
    {
        Console.WriteLine("----------------------------------------");
        Console.WriteLine($"AddInId: \t{application.ActiveAddInId?.GetAddInName()}");
        Console.WriteLine("----------------------------------------");

        return application.ActiveAddInId != null;
    }
}

 

I update my RevitAddin.DA.Tester project to use the library.

 

Now I just need to create a DA4R template 😊

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils