Thursday, July 14, 2005

Diving into Reflection

I've done some very miniscule things with reflection, basically just getting the version of assemblies. Now I find myself needing to access an assembly, then overwrite that assembly in the same code.

So, what I've found through digging here is I need to create a second app domain. I worked through it, did it, and was able to use the assembly from the app domain. But then I unloaded it to try to do the overwrite, and it failed. It was still in use.

It seems that even if you load something into the second domain, but try to get stuff out of it, like create an instance of a type (like an instance of a class) it still loads the assembly in your main or first domain. So, what I need to do, is in domain1, create an object inheriting from MarshalByRefObject, and create it in the second domain to do the work.

I'll be thinking about this long and hard.

In the mean time, I have been training my new apprentice. He is a PHP guy, and I'm bringing him to the dark side, I mean VB .Net side.

No comments: