I've got a nasty problem. I'm trying to allow mcml in a separate assembly that is loaded at runtime to gain access back to itself inside mcml. Okay, that was a mouthful, let me try to explain.
We have a plug-in architecture that allows things to be added on to our app at runtime. It works very well. In the course of this, we allow the loaded assembly (plug-in) to provide mcml for us to run in the context of our application. That works well too (by using the source attribute of the host object).
Where I'm having an issue is a specific instance (our config page) where the plug-in has some mcml that is loaded by the main app and that mcml needs to reference an object inside of the plug-in. We can't pass the object directly into the mcml because it is generic and must have the same parameters as all of these types of mcml UIs. BUT, I do have the ability for my plug-in to register an object with the main app (just put it in a list) and then, the mcml in our plugin can reference that object via a method on the application object (that is one of the generic variables passed to the mcml).
I then simply type cast that reference to the proper type in the plug-in and then (should) be able to access specific methods and properties on that type. Here's what the reference looks like in the mcml:
(in the locals)
<us:MyConfig Name="Config" />
(in the rules)
<Default Target="[Config]" Value="[Application.CurrentConfigObject!us:MyConfig]" />
Where us: is defined as our assembly and "MyConfig" is the actual class of the object. Now I can reference properties that are on MyConfig in the mcml with something like [Config.Property].
You still with me...?
This all works famously while running a debug build. Everything does just what I expect. But, as soon as I build a "Release" version and run that, it bombs out on the first reference to any member of Config and says it can't find "whatever" on MyConfig.