<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Life on Planet Groove &#187; WinForms</title>
	<atom:link href="http://www.lifeonplanetgroove.com/blog/index.php/category/tech/winforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lifeonplanetgroove.com/blog</link>
	<description>Adam Toth's Blog</description>
	<lastBuildDate>Thu, 27 May 2010 21:07:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PDC Day 1 KeyNote Notes</title>
		<link>http://www.lifeonplanetgroove.com/blog/index.php/2009/11/18/pdc-day-1-keynote-notes/</link>
		<comments>http://www.lifeonplanetgroove.com/blog/index.php/2009/11/18/pdc-day-1-keynote-notes/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 15:53:55 +0000</pubDate>
		<dc:creator>Adam Toth</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[WF]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[WinForms]]></category>
		<category><![CDATA[appfabric]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[pdc09]]></category>

		<guid isPermaLink="false">http://www.lifeonplanetgroove.com/blog/index.php/2009/11/18/pdc-day-1-keynote-notes/</guid>
		<description><![CDATA[
Windows Azure Improvements since last year:
Support PHP, CGI, Apache, other frameworks
Expose very low-level programming efforts (not just .NET).      Example was a C++ app with pointers exposed as an Azure service
Identity framework (support passing tokens from federated locations i.e. onsite AD instance)


SQL Azure Improvements since last year:
Not just RESTful consumption of [...]]]></description>
			<content:encoded><![CDATA[<ol>
<p>Windows Azure Improvements since last year:</p>
<li>Support PHP, CGI, Apache, other frameworks</li>
<li>Expose very low-level programming efforts (not just .NET).      <br />Example was a C++ app with pointers exposed as an Azure service</li>
<li>Identity framework (support passing tokens from federated locations i.e. onsite AD instance)</li>
</ol>
<ol>
<p>SQL Azure Improvements since last year:</p>
<li>Not just RESTful consumption of services anymore</li>
<li>Works with standard TDS based tools (SQL management studio)</li>
</ol>
<ol>
<p>Microsoft has a vision of &quot;Three screens and a Cloud&quot;.</p>
<p>The screens include:</p>
<li>Mobile devices</li>
<li>Desktop computers</li>
<li>Internet connected TVs
<p>They can all be united by data and services in the cloud.</p>
</li>
</ol>
<p><a href="http://pinpoint.microsoft.com/en-US/Dallas" target="_blank">Public Data in the Cloud (Codename &quot;Dallas&quot;)</a>. </p>
<p>Repository for public data sets that can be consumed in any number of ways (and easily by Azure)</p>
<p>Accessed through Microsoft PinPoint</p>
<p><a href="http://www.microsoft.com/windowsazure/developers/dallas/" target="_blank">Sign up for a CTP key</a></p>
<p>Some data includes NASA mars photos, GIS data, AP News articles</p>
<p><strong>PinPoint</strong>:</p>
<p>Centralized marketplace for partner providers, Azure ISVs and implementers, and gateway to &quot;Dallas&quot; public Data.</p>
<p>&quot;System Center&quot; will plugin to Azure to monitor your Azure instances, check to meet SLAs, and enable you to scale up the Azure instances directly.</p>
<p>2010 will include ability to have the Azure cloud be able to establish a network connection to on-premise resources (i.e. self hosted SQL Server)</p>
<p>WordPress is moving to Windows Azure</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lifeonplanetgroove.com/blog/index.php/2009/11/18/pdc-day-1-keynote-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET Plugin DLL Hell (aka assembly binding nightmares)</title>
		<link>http://www.lifeonplanetgroove.com/blog/index.php/2009/10/20/net-plugin-dll-hell-aka-assembly-binding-nightmares/</link>
		<comments>http://www.lifeonplanetgroove.com/blog/index.php/2009/10/20/net-plugin-dll-hell-aka-assembly-binding-nightmares/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 01:08:25 +0000</pubDate>
		<dc:creator>Adam Toth</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[WinForms]]></category>
		<category><![CDATA[assembly binding]]></category>
		<category><![CDATA[dll hell]]></category>
		<category><![CDATA[fusion log]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://www.lifeonplanetgroove.com/blog/index.php/2009/10/20/net-plugin-dll-hell-aka-assembly-binding-nightmares/</guid>
		<description><![CDATA[I’ve worked on a few .NET WinForms applications that utilized a “plugin” model. You’ve probably seen similar apps out there, where a main application searches a directory for DLLs, and then tries to load them into the AppDomain, using some code like below:


Assembly plugin = System.Reflection.Assembly.LoadFrom(pluginFileName);

object pluginClass = Activator.CreateInstance(plugin.GetType(&#34;Plugin.PluginClass&#34;));

&#160;


This kind of architecture is pretty standard, [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve worked on a few .NET WinForms applications that utilized a “plugin” model. You’ve probably seen similar apps out there, where a main application searches a directory for DLLs, and then tries to load them into the AppDomain, using some code like below:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">Assembly plugin = System.Reflection.Assembly.LoadFrom(pluginFileName);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">object</span> pluginClass = Activator.CreateInstance(plugin.GetType(<span style="color: #006080">&quot;Plugin.PluginClass&quot;</span>));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></div>
</div>
<p>This kind of architecture is pretty standard, and is one of the few ways to accomplish this plugin model in .NET (other than some cutting-edge things like <a href="http://mef.codeplex.com/" target="_blank">MEF</a>). It works for the most part, but has some obvious limitations, such as:</p>
<ul>
<li>Once a DLL is loaded in this manner, it cannot be unloaded from memory (unless you mess around with <a href="http://people.oregonstate.edu/~reeset/blog/archives/466" target="_blank">AppDomains for each plugin</a>)</li>
<li>If your plugins want to talk to one another, they pretty much have to go through a lot of plumbing code in the main app </li>
</ul>
<p>Where it really starts to have problems is when your plugin DLL needs to reference other DLLs used by the main application, or other plugin DLLs, and you find yourself in <strong>.NET Plugin DLL Hell</strong>.</p>
<p>Here is the crux of the problem:</p>
<p><strong>When you add a reference to a DLL via Visual Studio, the framework will always try to load an exact matching version of that assembly, and will fail if it can’t find it. So, good luck if that DLL you depend on ever gets upgraded to a new version.</strong></p>
<p>You can usually control this with a standalone application, because when you upgrade the app, you upgrade all the dependencies at the same time. In a plugin model, you can’t control when other dependencies are upgraded, and so your plugin will simply fail to load when this happens.</p>
<p>There is no way in the .NET framework to tell it to use a particular version of a DLL <strong>or any newer version it finds</strong>.</p>
<p>Here’s a scenario to demonstrate this: </p>
<ul>
<li>You have a WinForms application, that loads plugin DLLs when the app starts. </li>
<li>The main application uses a third-party control library. </li>
<li>You write a plugin that also needs the controls, so you add a reference to the version that the main app uses. </li>
<li>At some point, someone working on the main app upgrades it to use a newer controls DLL, recompiles the app, and distributes it along with the newer controls DLL. </li>
<li>Since no work was actually done on your plugin, no one has recompiled it against the newer controls DLL. </li>
<li>When the upgraded application starts and loads your plugin, your plugin goes BOOM! </li>
</ul>
<p>Another scenario:</p>
<ul>
<li>Your plugin references another plugin </li>
<li>The other plugin gets upgraded without your plugin getting recompiled </li>
<li>Your plugin now goes BOOM! </li>
</ul>
<p>When I say “BOOM!”, I mean you’ll probably see something like this from the Fusion log:</p>
<p><em>&quot;System.IO.FileNotFoundException: Could not load file or assembly ‘YourDependentAssemblyNameHere’ or one of its dependencies. The system cannot find the file specified.”</em>&#160;</p>
<p>I am having a similar problem with my Windows LiveWriter plugin, <a href="http://www.lifeonplanetgroove.com/blog/index.php/projects/xpollinate-windows-live-writer-cross-post-plugin" target="_blank">xPollinate</a>. Every time Microsoft releases a new version of LiveWriter, all of its DLLs that I reference have new version numbers, and so my plugin will fail to load unless I recompile my plugin against the latest versions of the DLLs. </p>
<p>Well, so what are our options to deal with this?</p>
<ul>
<li>You can simply not add any references in your plugin project via Visual Studio, and just use reflection for everything (yuck). This is probably a little easier now with the dynamic keyword in C#, but not much. </li>
<li>You can try to get the main application to put in assembly binding redirects in its config file for any common DLLs that might be referenced by plugins. </li>
</ul>
<p>That’s all I can see at this point. Here’s to hoping a future version of the framework will make this easier for us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lifeonplanetgroove.com/blog/index.php/2009/10/20/net-plugin-dll-hell-aka-assembly-binding-nightmares/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
