Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LoaderLock exception when open a drawing document in Inventor Addin C#

5 REPLIES 5
Reply
Message 1 of 6
andrenaulfal
1073 Views, 5 Replies

LoaderLock exception when open a drawing document in Inventor Addin C#

Hi guys! I'm doing a addin in C# using Visual Studio 2013 and .NET Framework 4.5 to run in Inventor 2014. One of the functions of the addin is to read a BOM of the assembly and then, open a several files where each one of this is a drawing of a part in this asembly. Everything is going well until this point, but in this part of the code : DrawingDocument oDocumentoDetalhamento = (DrawingDocument) inventorAPP.Documents.Open(path, false); Sometimes, I receive the following exception: LoaderLock occurred Message: Managed Debugging Assistant 'LoaderLock' has detected a problem in 'C:\Program Files\Autodesk\Inventor 2014\Bin\Inventor.exe'. Additional information: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang. This exception only occurs sometimes and I can't understand why. Someone know how pass through this exception ?
5 REPLIES 5
Message 2 of 6
santoshr0114
in reply to: andrenaulfal

Message 3 of 6
andrenaulfal
in reply to: santoshr0114

Hey, thanks for the reply but I've done this process and now instead I get this exception both Inventor as my addin crash. Again, it just rushes sometimes for no apparent reason.

Message 4 of 6
santoshr0114
in reply to: andrenaulfal

I got the same LoaderLock message when i was trying to open a PartDocument. That Solution worked for me.

 

Can you try using Document Object to open rather than DrawingDocument. That is not a problem, but you can simply try that out.

Regards
Santosh
Message 5 of 6
andrenaulfal
in reply to: santoshr0114

I did what do you proposed and now I received the following exception:

 

ContextSwitchDeadlock occurred
Message: Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Program Files\Autodesk\Inventor 2014\Bin\Inventor.exe'.

 

This is the code to open de document:

 

Document oDocumento = inventorAPP.Documents.Open(path, false);

 
Now without the Loader Lock detection in the Visual Studio I have three scenarios:

 

1 - The addin works correctly;
2 - The addin freezes (with the Inventor) in this line of code;
3 - The addin return the exception "ContextSwitchDeadlock occurred".

 

In the code, I try to open several files, but this exception always occur when I try to open the first drawing document in my list.

I never seen those exceptions before.

 

 Any ideas ?

Message 6 of 6
santoshr0114
in reply to: andrenaulfal

Hi,

 

I am out of ideas....

I am also trying to reproduce the issue, but unable to do so.

Did u check your call stack ?

 

Check the below link

http://forums.autodesk.com/t5/Inventor-Customization/Debugging-2012-addin-with-VS2010/td-p/3065260

 

I am not sure whether this will help you out...!

 

 

Regards
Santosh

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report