<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://discuss.mediacentersandbox.com/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Media Center Markup Language</title><link>http://discuss.mediacentersandbox.com/forums/3/ShowForum.aspx</link><description>Discuss Media Center Markup Language (MCML), the XML declarative language for Windows Media Center Presentation Layer.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.0 (Build: 60217.2664)</generator><item><title>Reference works in debug but not release</title><link>http://discuss.mediacentersandbox.com/forums/thread/9512.aspx</link><pubDate>Thu, 17 Dec 2009 18:01:15 GMT</pubDate><guid isPermaLink="false">edf2c9e4-3a2f-48fb-a021-c4ce4a1a3ed1:9512</guid><dc:creator>ebr</dc:creator><slash:comments>0</slash:comments><comments>http://discuss.mediacentersandbox.com/forums/thread/9512.aspx</comments><wfw:commentRss>http://discuss.mediacentersandbox.com/forums/commentrss.aspx?SectionID=3&amp;PostID=9512</wfw:commentRss><description>&lt;P&gt;I've got a nasty problem.&amp;nbsp; I'm trying to allow mcml in a separate assembly that is loaded at runtime to gain access back to itself inside mcml.&amp;nbsp; Okay, that was a mouthful, let me try to explain.&lt;/P&gt;
&lt;P&gt;We have a plug-in architecture that allows things to be added on to our app at runtime.&amp;nbsp; It works very well.&amp;nbsp; 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.&amp;nbsp; That works well too (by using the source attribute of the host object).&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp; 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.&amp;nbsp; 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).&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp; Here's what the reference looks like in the mcml:&lt;/P&gt;
&lt;P&gt;(in the locals)&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;us:MyConfig&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;Name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Config&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; /&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000 size=3&gt;
&lt;P&gt;(in the rules)&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;Default&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;Target&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;[Config]&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;Value&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;[Application.CurrentConfigObject!us:MyConfig]&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; /&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000 size=3&gt;Where us: is defined as our assembly and "MyConfig" is the actual class of the object.&amp;nbsp; Now I can reference properties that are on MyConfig in the mcml with something like [Config.Property].&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000 size=3&gt;You still with me...?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This all works famously while running a debug build.&amp;nbsp; Everything does just what I expect.&amp;nbsp; 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.&lt;/P&gt;
&lt;P&gt;Any clues?&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description></item></channel></rss>