Main Site Documentation

Dynamically reloading an assembly locks up


#1

I am working on a system that does some motion control and I want to be able to dynamically load/unload assemblies at run time to control the sequence of motions. The problem is, if I create a new AppDomain to load an assembly and then unload the AppDomain the next time I try and use the same assembly in a new AppDomain the call to CreateInstanceAndUnwrap never returns.

Here is the trace if I step into the call:

Step into: Stepping over non-user code 'System.AppDomain.CurrentDomain.get’
Step into: Stepping over non-user code 'System.AppDomain.CurrentDomain.get’
Step into: Stepping over non-user code 'System.AppDomain.CreateInstanceAndUnwrap’
Step into: Stepping over non-user code 'System.Reflection.Assembly.Load’
Step into: Stepping over non-user code 'System.Reflection.Assembly.Load’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'ushort.Parse’
Step into: Stepping over non-user code 'System.Convert.ToUInt16’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToUInt16’
Step into: Stepping over non-user code 'ushort.Parse’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'ushort.Parse’
Step into: Stepping over non-user code 'System.Convert.ToUInt16’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToUInt16’
Step into: Stepping over non-user code 'ushort.Parse’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'int.Parse’
Step into: Stepping over non-user code 'System.Convert.ToInt32’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt32’
Step into: Stepping over non-user code 'int.Parse’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'int.Parse’
Step into: Stepping over non-user code 'System.Convert.ToInt32’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt64’
Step into: Stepping over non-user code 'System.Convert.ToInt32’
Step into: Stepping over non-user code 'int.Parse’
Step into: Stepping over non-user code 'System.Reflection.Assembly.ParseAssemblyName’
Step into: Stepping over non-user code 'System.Reflection.Assembly.Load’
The debugging target runtime is loading the application assemblies and starting execution.

I an running with NETMF and Gadgeteer Package 2014 R2 on a Cobra II.


#2

Is this something you try with a simple program on the emulator on the PC instead of the hardware?


#3

I created a mew emulator project and get the same result.


#4

@ Mike Y. - If it happens in the emulator it looks like it is an issue with NETMF itself.


#5

Yes. I meant to update that I created a discussion topic on CodePlex for it.