CreateInstanceAndUnwrap()
#1
Posted 16 December 2010 - 02:56 AM
#2
Posted 17 December 2010 - 09:28 AM
Is CreateInstanceAndUnwrap() implemented in the Netduino+?
I've tried using it and even the simplest example throws System.NotImplementedException.
I doubt it, why would you need it?
Miha Markic, Microsoft MVP C#
Righthand .net consulting and software development
http://blog.rthand.com/
#3
Posted 17 December 2010 - 01:49 PM
I doubt it, why would you need it?
It's useful for demand loading an assembly into an AppDomain. There are discussions in other threads about using it to load an assembly from the microSD card. (and since I just got my Netduino+, I thought I'd give it a try.)
#4
Posted 19 December 2010 - 02:59 PM
It's useful for demand loading an assembly into an AppDomain. There are discussions in other threads about using it to load an assembly from the microSD card. (and since I just got my Netduino+, I thought I'd give it a try.)
Looking at .NET MF v4.1 sources it seems actually implemented. Does your class have a parameterless constructor?
Miha Markic, Microsoft MVP C#
Righthand .net consulting and software development
http://blog.rthand.com/
#5
Posted 22 December 2010 - 07:36 PM
#6
Posted 24 December 2010 - 10:31 PM
#7
Posted 25 December 2010 - 05:10 AM
I find it odd that this issue is not being addressed by someone on the Secret Labs team. Why is that?
Hi Fabien,
It is being worked on; my apologies that I didn't pitch in earlier in the thread... I've been taking notes and updating our internal ticket while we build a few good repro cases and debug into the .NET MF core.
We're pretty short-staffed for the holidays and we're working on the v4.1.0.6b2 and v4.1.1.0a4 updates...but I should have more info during the holidays. I will post more info as soon as I have it.
Thank you very much for your enthusiasm and for helping push the boundaries of the platform...
Chris
#8
Posted 30 December 2010 - 12:01 AM
Cheers,
-Fabien.
#9
Posted 30 December 2010 - 05:32 AM
#10
Posted 31 December 2010 - 12:57 AM
Just closing the loop: I figured out how to load assemblies dynamically and wrote post about it on my blog: http://fabienroyer.w...ith-a-netduino/
Cheers,
-Fabien.
Awesome! I don't yet have a use for this, but I'm sure I soon will...
#11
Posted 03 January 2011 - 08:30 PM
Thank for posting your results, Fabien. We should put together a framework for easy loading of dynamic code.
Interestingly, it appears that assemblies may need to be loaded into the main appdomain on .NET MF before they can be used in secondary domains.
Chris
You're welcome
I think it would be great to have a standard way of loading dynamic code efficiently on the netduino. However, I also think that documentation alone would go a long way and would not increase the footprint of the firmware ;-)
Cheers,
-Fabien.
#12
Posted 05 January 2011 - 02:26 AM
I figured out how to load assemblies dynamically...
Awesome! This was on my To-Do list! Thanks Fabien!
-Valkyrie-MT
#13
Posted 17 January 2011 - 04:47 AM
Have you (or anyone else) had any luck loading and executing assemblies in a secondary domain? I think loading into an AppDomain other than the current domain is necessary in order to support unloading the AppDomain after the assembly has served its purpose -- i.e. so you can reclaim that memory for other uses (like loading another, different assembly).
Chris Walker commented that an assembly needed to be loaded into the current AppDomain before it is loaded into a secondary domain. (If this is the case, using a secondary domain may defeat the purpose or even make things worse from a memory use standpoint.)
I have not yet been successful in loading an assembly into a secondary domain, but I'll keep trying and post my results.
#14
Posted 19 January 2011 - 08:59 PM
Thanks Fabien for figuring out how to load assemblies into the current AppDomain. Your technique works great!
Have you (or anyone else) had any luck loading and executing assemblies in a secondary domain? I think loading into an AppDomain other than the current domain is necessary in order to support unloading the AppDomain after the assembly has served its purpose -- i.e. so you can reclaim that memory for other uses (like loading another, different assembly).
Chris Walker commented that an assembly needed to be loaded into the current AppDomain before it is loaded into a secondary domain. (If this is the case, using a secondary domain may defeat the purpose or even make things worse from a memory use standpoint.)
I have not yet been successful in loading an assembly into a secondary domain, but I'll keep trying and post my results.
Hi Al,
You're welcome
I have not spent much time investigating loading assemblies into a secondary domain yet.
As far as unloading/reloading assmblies goes, I solved the problem like this: when the SD card is swapped out and a new one is inserted into the reader, I generate an interrupt which forces a reset of the netduino. At that point, the app re-initializes itself and loads the new version of the assembly from the SD card. It's simple and reliable I realize that this method may not fit all scenarios.
I hope this helps.
Cheers,
-Fabien.
#15
Posted 13 April 2012 - 03:08 AM
#16
Posted 03 April 2013 - 06:26 AM
Couple of questions,
Is is possible to load an assembly in a secondary domain now?
How about Bengage's question, is it possible to debug the code of the assembly being loaded or not?
Thanks
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users