Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NET Api unload/reload plugin?

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
2218 Views, 7 Replies

NET Api unload/reload plugin?

Anonymous
Not applicable

Hey there,

 

I am porting a C++ based plugin over to the C# /.NET API.

With C++ I could always simply unload the plugin, recompile, and re-load it.

 

Now with the .NET plugin, unloading does not appear to fully release the plugin anymore: when compiling it after unloading it from the plugin-manager window it will tell me that the DLL is still used by another process.

 

Is this a known issue with the NET api or is there something i can do?

 

0 Likes

NET Api unload/reload plugin?

Hey there,

 

I am porting a C++ based plugin over to the C# /.NET API.

With C++ I could always simply unload the plugin, recompile, and re-load it.

 

Now with the .NET plugin, unloading does not appear to fully release the plugin anymore: when compiling it after unloading it from the plugin-manager window it will tell me that the DLL is still used by another process.

 

Is this a known issue with the NET api or is there something i can do?

 

7 REPLIES 7
Message 2 of 8
zhong_wu
in reply to: Anonymous

zhong_wu
Autodesk Support
Autodesk Support

Yes, this issue seems annoying, I have to restart Maya to avoid that. But luckily, it's already a known issue, and we had reported this issue to our engineering team. The ticket number is Maya-27532.

 


John Wu
Developer Technical Services
Autodesk Developer Network


0 Likes

Yes, this issue seems annoying, I have to restart Maya to avoid that. But luckily, it's already a known issue, and we had reported this issue to our engineering team. The ticket number is Maya-27532.

 


John Wu
Developer Technical Services
Autodesk Developer Network


Message 3 of 8
cyrille
in reply to: zhong_wu

cyrille
Alumni
Alumni

Hi

 

it is actually impossible (or almost impossible) to unload a .Net DLL because there is no way to unload assembly dll from a domain. The only way to unload .Net code is to load an assembly in another appdomain and when you wanted to reload it, stop it it and start it again.

So while you can't unload or reload a dll, you can unload and reload an appdomain and execute code in it. But it turns not applicable directly to a plug-in framework,

 

cheers

cyrille

0 Likes

Hi

 

it is actually impossible (or almost impossible) to unload a .Net DLL because there is no way to unload assembly dll from a domain. The only way to unload .Net code is to load an assembly in another appdomain and when you wanted to reload it, stop it it and start it again.

So while you can't unload or reload a dll, you can unload and reload an appdomain and execute code in it. But it turns not applicable directly to a plug-in framework,

 

cheers

cyrille

Message 4 of 8
Anonymous
in reply to: cyrille

Anonymous
Not applicable
Cyrille,

Yes, we are aware of that issue with .Net (unloading only possible via hosting it in and destroying an AppDomain).
We have been successfully using that method for in-house plugin frameworks in .Net, but it required additional MarshalByRef methods to gain access to the plugin.

Of course, I am not familiar with the requirements of the Maya plugin framework, but if I can give more insight into how we overcame the issue, let me know.

Marius
0 Likes

Cyrille,

Yes, we are aware of that issue with .Net (unloading only possible via hosting it in and destroying an AppDomain).
We have been successfully using that method for in-house plugin frameworks in .Net, but it required additional MarshalByRef methods to gain access to the plugin.

Of course, I am not familiar with the requirements of the Maya plugin framework, but if I can give more insight into how we overcame the issue, let me know.

Marius
Message 5 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

Hello Marius,

Is it possible for you to share how you unload/reload plugin?

 

I'm trying to develop a .net plugin and would like to debug at any time using Visual Studio but since if that assembly was ever loaded prior to I can only debug my updated code by closing Maya once and they starting it again.

 

Thanks for your help in advance.

 

macyaroze

0 Likes

Hello Marius,

Is it possible for you to share how you unload/reload plugin?

 

I'm trying to develop a .net plugin and would like to debug at any time using Visual Studio but since if that assembly was ever loaded prior to I can only debug my updated code by closing Maya once and they starting it again.

 

Thanks for your help in advance.

 

macyaroze

Message 6 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Hey mac,

Currently there is no workaround that I know of, we close Maya and reload it to use the updated recompiled .NET DLL.
As zhong mentioned, there is a ticket for this already.

Marius

Hey mac,

Currently there is no workaround that I know of, we close Maya and reload it to use the updated recompiled .NET DLL.
As zhong mentioned, there is a ticket for this already.

Marius
Message 7 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Thanks, Marius. I appreciate for the clarification.
0 Likes

Thanks, Marius. I appreciate for the clarification.
Message 8 of 8
carpenjl
in reply to: Anonymous

carpenjl
Explorer
Explorer

I know that this is an old thread and just stumbled upon it. There is a way to do this without having to close the main application. You load in an assembly that points to a separate Dev assembly and work out of the dev assembly while working. That way you don't have to go through the process of closing and restarting the application every time you make changes to your code.

0 Likes

I know that this is an old thread and just stumbled upon it. There is a way to do this without having to close the main application. You load in an assembly that points to a separate Dev assembly and work out of the dev assembly while working. That way you don't have to go through the process of closing and restarting the application every time you make changes to your code.

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

Post to forums  

Autodesk Design & Make Report