Help Needed! PropertyGrid and Remoted Objects
Alright, I am having a really hard time trying to solve an issue in CodeSmith and I am hoping that you guys can help me out.
The basic problem is that currently every time you compile a template in CodeSmith it creates a dynamic assembly which is then loaded into the current AppDomain and the template class inside of that assembly is instantiated and attached to the property grid control so that the template properties can be set before execution of the template. As you might imagine, over time all of these dynamic assemblies being loaded into the AppDomain and never unloaded (can't unload an assembly) is causing a memory leak in CodeSmith and locks all of the referenced assemblies until CodeSmith is shut down.
The obvious answer to this problem is to move load and execution of templates into a separate AppDomain that can be unloaded, right? Well, I've run into some issues with that approach that I am so far unable to resolve. A remoted object can't be used in the property grid control. I've tried implementing ICustomTypeDescriptor thinking that would be the answer that I was looking for, but I was unsuccessful. There are a couple other ideas that I am tossing around, but I'm not happy with any of them.
If anyone out there knows how to solve this issue, I would be extremely grateful for a little nudge in the right direction. I will be offering some free CodeSmith Professional licenses to the person(s) that help me solve this problem.
Thanks,
Eric J. Smith