<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://arildf.spaces.live.com/mmm2008-04-25_07.02/rsspretty.aspx?rssquery=en-US;http%3a%2f%2farildf.spaces.live.com%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Random thoughts about AnkhSVN, .NET, Powershell and other stuff</title><description /><link>http://arildf.spaces.live.com/</link><language>en-US</language><pubDate>Tue, 13 May 2008 03:31:43 GMT</pubDate><lastBuildDate>Tue, 13 May 2008 03:31:43 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><live:identity><live:id>-1612417020300539472</live:id><live:alias>arildf</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>1.0.3 prerelease available</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!311.entry</link><description>&lt;p&gt;I invite everyone to try out the pre-release 1.0.3 version(almost done, just need to work out a kink with the installer). It goes a long way towards fixing the annoying problem where statuses aren't populated on projects that are in solution folders. The solution isn't perfect, and we have a long-term plan for a better way of doing it, but it's a huge improvement over the current (1.0.2) state of things.  &lt;p&gt;Find it at our &lt;a href="http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!310.entry"&gt;new &lt;/a&gt;host: &lt;a title="http://ankhsvn.open.collab.net/servlets/ProjectDocumentList?folderID=199&amp;amp;expandFolder=199&amp;amp;folderID=0" href="http://ankhsvn.open.collab.net/servlets/ProjectDocumentList?folderID=199&amp;amp;expandFolder=199&amp;amp;folderID=0"&gt;http://ankhsvn.open.collab.net/servlets/ProjectDocumentList?folderID=199&amp;amp;expandFolder=199&amp;amp;folderID=0&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+1.0.3+prerelease+available&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!311.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!311.entry</guid><pubDate>Mon, 18 Feb 2008 20:58:05 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!311/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!311.entry#comment</wfw:comment><dcterms:modified>2008-02-18T20:58:05Z</dcterms:modified></item><item><title>AnkhSVN now on openCollabNet</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!310.entry</link><description>&lt;p&gt;Hosting for the AnkhSVN project has now moved to &lt;a title="http://ankhsvn.open.collab.net/" href="http://ankhsvn.open.collab.net/"&gt;http://ankhsvn.open.collab.net/&lt;/a&gt;. openCollabNet is &lt;a href="http://www.open.collab.net/"&gt;&amp;quot;the online community extension to CollabNet products and Subversion&amp;quot;&lt;/a&gt; and the move represents an official commitment by &lt;a href="http://www.collab.net/"&gt;CollabNet&lt;/a&gt; (the original sponsor of &lt;a href="http://subversion.tigris.org"&gt;Subversion&lt;/a&gt;) to the AnkhSVN project in the form of developer time and other resources.  &lt;p&gt;The Subversion repository has also been moved, and the new repository URL is &lt;a title="http://ankhsvn.open.collab.net/svn/ankhsvn/trunk" href="http://ankhsvn.open.collab.net/svn/ankhsvn/trunk"&gt;http://ankhsvn.open.collab.net/svn/ankhsvn/trunk&lt;/a&gt;. Unlike before, anonymous access is no longer available, but you can checkout the repository using the username &amp;quot;guest&amp;quot; and a blank password. You can also browse the repository using the web interface at &lt;a title="http://ankhsvn.open.collab.net/source/browse/ankhsvn/" href="http://ankhsvn.open.collab.net/source/browse/ankhsvn/"&gt;http://ankhsvn.open.collab.net/source/browse/ankhsvn/&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+AnkhSVN+now+on+openCollabNet&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!310.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!310.entry</guid><pubDate>Mon, 18 Feb 2008 20:52:57 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!310/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!310.entry#comment</wfw:comment><dcterms:modified>2008-02-18T20:52:57Z</dcterms:modified></item><item><title>AnkhSVN 1.0.2 released (security fix)</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!262.entry</link><description>&lt;p&gt; &lt;p&gt;Following the announcement of the security vulnerability in pre-1.4.5 Subversion, I am pleased to announce the release of AnkhSVN 1.0.2. This release can be downloaded from &lt;a href="http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315"&gt;http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315&lt;/a&gt; &lt;p&gt;This release links to Subversion 1.4.5, which fixes the security vulnerability described in &lt;a title="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0157" href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0157"&gt;&lt;a title="http://cve.mitre.org/cgi-bin/cvename.cgi?name=2007-3846" href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=2007-3846"&gt;http://cve.mitre.org/cgi-bin/cvename.cgi?name=2007-3846&lt;/a&gt;&lt;/a&gt;. There are no other changes from 1.0.1.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+AnkhSVN+1.0.2+released+(security+fix)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!262.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!262.entry</guid><pubDate>Tue, 28 Aug 2007 06:55:33 GMT</pubDate><slash:comments>11</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!262/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!262.entry#comment</wfw:comment><dcterms:modified>2007-08-28T06:58:13Z</dcterms:modified></item><item><title>AnkhSVN 1.0 released!</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!221.entry</link><description>&lt;p&gt; &lt;p&gt;I'm happy to announce the release of AnkhSVN 1.0. The release can be downloaded from &lt;p&gt;&lt;a href="http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315"&gt;http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315&lt;/a&gt; &lt;p&gt;This release was built against Subversion 1.4.2, Neon 0.25.5, openssl 0.9.8a and Berkeley DB 4.4.20 &lt;p&gt;Changes from RC4(*): &lt;ul&gt; &lt;li&gt;Work around a couple of AccessViolations that would be thrown from the VS object model in certain cases. &lt;li&gt;Fix refreshing of projects and projectitems statuses after certain operations. &lt;li&gt;Fix some spurious expansions of the solution explorer in certain cases. &lt;li&gt;More icons from DamienG &lt;li&gt;Workaround for the error SVN throws when deleting a missing-but-added file.&lt;/ul&gt; &lt;p&gt;* Full changelog can be viewed at &lt;a href="http://ankhsvn.com/AnkhWiki/Changelog.ashx"&gt;http://ankhsvn.com/AnkhWiki/Changelog.ashx&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+AnkhSVN+1.0+released!&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!221.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!221.entry</guid><pubDate>Tue, 23 Jan 2007 21:10:52 GMT</pubDate><slash:comments>48</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!221/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!221.entry#comment</wfw:comment><dcterms:modified>2007-01-23T21:10:52Z</dcterms:modified></item><item><title>Ankh and AccessViolationExceptions</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!216.entry</link><description>&lt;p&gt;Lately, I've been receiving a number of Ankh error reports that had an AccessViolationException. This was particularly weird because you cannot get that exception from safe managed code. AccessViolationException is the exception you get when you try to access memory you're not allowed to access, usually because you are dereferencing an invalid pointer. Since safe managed code does not expose raw pointers, it's not an exception you usually see in .NET development. &lt;p&gt;As it turned out, the exception came from a property accessor on an object from the Visual Studio automation model, a Project object. This is a COM object exposed to .NET and is implemented by the implementor of a specific project type, such as a C# project or a C++ project. Being a COM object, it can, of course, be implemented in a non-managed language, usually C++, which I suspect is the case here. &lt;p&gt;That answered the question of why such an exception could be caught inside Ankh, but it did not answer why we were seeing it in this particular case. It took a while for me to be able to reproduce it, but one submitter of an error report finally gave me a reproducible recipe: he had clicked on a linker error message in the Visual Studio error list. Linker errors aren't associated with a specific source file, so clicking it usually does you no good, but in this case, it was clear that Ankh was doing something in response to this clicking and in the process, triggering the exception. &lt;p&gt;All files opened in Visual Studio belong to a project. This holds true even if you open a file that's not part of your current solution, or if you don't have a solution open. In that case, Visual Studio has a special project called &amp;quot;Miscellaneous Items&amp;quot;, into which all files not part of any other project are put. This project is usually not shown in the solution explorer, but you can enable it by checking the &amp;quot;Show Miscellaneous files in Solution Explorer&amp;quot; checkbox in Tools-&amp;gt;Options-&amp;gt;Environment-&amp;gt;Documents. &lt;p&gt;This project is not always present; rather, VS will load this project when the first &amp;quot;miscellanous&amp;quot; file is opened and close it again when no such files remain. Ankh has code to detect when a project is loaded and unloaded, and when a project is unloaded, we hook up an event sink to handle the case where files are added to or removed from the project, so we can refresh the status icons in the solution explorer. However, when such an event is raised, we cannot perform the refresh right away, because for some weird reason, the object model for the items hasn't been updated to account for the changes yet. What we chose to do here is to schedule a delayed refresh of the item in question; ie, perform a refresh after a specific amount of time after the event. &lt;p&gt;What happened in this case was this: &lt;ol&gt; &lt;li&gt;User clicked on the linker error in the error list. &lt;li&gt;This, for some reason, triggered Visual Studio to load the Misc. Items project. &lt;li&gt;Ankh then dutifully hooked itself up as an event sink for events on the Misc. Items project &lt;li&gt;Visual Studio would then trigger the &amp;quot;Item added&amp;quot; event for the Misc. Items project (I'm not sure what it actually added, and don't think I'll spend much time trying to investigate it). &lt;li&gt;Ankh would then schedule a delayed refresh of the project. &lt;li&gt;Visual Studio would then, probably because it suddenly realized there was nothing to show, unload the Misc Items project again. &lt;li&gt;Ankh would unhook itself as an event sink for the Misc Items project. &lt;li&gt;&lt;em&gt;However&lt;/em&gt;, the delayed refresh would still fire after its given interval. &lt;li&gt;The refresh would then work against a Project object representing a project that was no longer loaded. Accessing its properties at this time triggers the AccessViolationException.&lt;/ol&gt; &lt;p&gt;The above sequence is a little simplified - Visual Studio did actually fire several Item Added and Item Removed events before unloading the Misc Items project, but it illustrates the problem. &lt;p&gt;One unanswered question here is why the COM/.NET infrastructure allowed the Project object to become invalid when there was still a reference to it in the managed heap. We've had a similar problem with ProjectItem objects, but in that case we got a more informative exception stating &amp;quot;ProjectItem not available&amp;quot;. &lt;p&gt;Oh well, now that I know what the problem is, I only have to find a solution :-)&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Ankh+and+AccessViolationExceptions&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!216.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!216.entry</guid><pubDate>Sun, 12 Nov 2006 18:24:41 GMT</pubDate><slash:comments>6</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!216/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!216.entry#comment</wfw:comment><dcterms:modified>2006-11-12T18:24:41Z</dcterms:modified></item><item><title>Ankh and Exclude From Project</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!215.entry</link><description>&lt;p&gt;There was a user on our users mailing list that asked if there was a way to remove a file from an Ankh-managed project without having Ankh delete it. I was about to tell him to use &amp;quot;Exclude from project&amp;quot; when I realized I should at least test it first (it's not a feature I use a lot). I was pretty shocked to see that we do in fact delete files when Exclude From Project is invoked (if they are versioned - we don't touch unversioned files). &lt;p&gt;I was even more shocked to see how VS behaves in this case:  The API we work against allows handling of delete (as well as rename and add) by implementing &lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivstrackprojectdocuments2_members(VS.80).aspx"&gt;a certain interface&lt;/a&gt;. This interface has two sets of methods, OnQueryRemove* and OnAfterRemove* (with * being either Files or Directories). Normally, VS will first call OnQueryRemove*, where we have the option of cancelling the delete, and if we don't, call OnAfterRemove*. &lt;p&gt;In the case of &amp;quot;Exclude from project&amp;quot;, OnQueryRemove* is not called. &lt;p&gt;However, OnAfterRemove* &lt;em&gt;is&lt;/em&gt; called, passing in a flag of VSREMOVEFILEFLAGS_IsDirectoryBased, &lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.vsremovefileflags(VS.80).aspx"&gt;which is documented as &amp;quot;Deprecated. Do not use.&amp;quot;&lt;/a&gt; &lt;p&gt;Gah.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Ankh+and+Exclude+From+Project&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!215.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!215.entry</guid><pubDate>Fri, 10 Nov 2006 21:09:59 GMT</pubDate><slash:comments>4</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!215/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!215.entry#comment</wfw:comment><dcterms:modified>2006-11-10T21:09:59Z</dcterms:modified></item><item><title>AnkhSVN 1.0 RC4 released</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!207.entry</link><description>&lt;p&gt;In the time since RC3, it became obvious from the error reports we received that renames and deletes were very buggy. Deleting a file and then committing it would often result in an error message saying &amp;quot;ProjectItem not available&amp;quot;. It was obvious that we could not release it as 1.0 as it was, and another release candidate would be necessary. We also received several reports of other problems that turned out to be rather critical to some people, or so trivial to fix that we considered it worth the risk. &lt;p&gt;It took some time to rework the handling of deletes and renames to avoid this error (it's a very tricky problem, I might write about it some day), thus the long delay in producing RC4. However, it is now available at &lt;a href="http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315"&gt;http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315&lt;/a&gt;. &lt;p&gt;Problems that have been fixed include: &lt;ul&gt; &lt;li&gt;The very common &amp;quot;ProjectItem not available&amp;quot; error.  &lt;li&gt;Templates for performing merge and diff using TortoiseMerge no longer has quotes.  &lt;li&gt;Reporting Services (and other Business Intelligence projects) now work.  &lt;li&gt;New icons (from &lt;a href="http://www.damieng.com/blog"&gt;DamienG)&lt;/a&gt;.  &lt;li&gt;Solution load timeout in VS 2005 is increased from ten seconds to fifteen minutes.  &lt;li&gt;Various embarrassing NullReferenceExceptions.  &lt;li&gt;New lines entered for the log message in the configuration dialog are now treated properly.  &lt;li&gt;Handle an edge-case which prevented deletes from working with F# projects.  &lt;li&gt;Work around a NotImplementedException thrown in certain cases by certain third party project types.  &lt;li&gt;Various bug fixes in the support for database projects.  &lt;li&gt;Message box now shown if one or more items could not be Locked (previously this information was shown only in the output pane, and easily missed).  &lt;li&gt;Avoid a weird race condition in the repository explorer which might throw an exception in certain edge cases.&lt;/ul&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+AnkhSVN+1.0+RC4+released&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!207.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!207.entry</guid><pubDate>Sat, 28 Oct 2006 11:29:42 GMT</pubDate><slash:comments>5</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!207/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!207.entry#comment</wfw:comment><dcterms:modified>2006-10-28T11:29:42Z</dcterms:modified></item><item><title>New wiki</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!204.entry</link><description>&lt;p&gt;I have now changed the Wiki software for the &lt;a href="http://ankhsvn.com/AnkhWiki/AnkhSVN+Wiki+Home.ashx"&gt;AnkhSVN wiki&lt;/a&gt; to the wiki engine &lt;a href="http://dotavery.com/blog/archive/2006/10/19/22818.aspx"&gt;everyone&lt;/a&gt; &lt;a href="http://www.arcware.net/archive/2006/10/17/ScrewTurn-Wiki.aspx"&gt;is&lt;/a&gt; &lt;a href="http://www.ayende.com/Blog/ScrewTurnWikiThumbsUp.aspx"&gt;blogging&lt;/a&gt; &lt;a href="http://pluralsight.com/blogs/craig/archive/2006/10/23/41065.aspx"&gt;about&lt;/a&gt;, namely &lt;a href="http://www.screwturn.eu/"&gt;ScrewTurn&lt;/a&gt;. I was immediately impressed by just how slick ScrewTurn was; dead easy to install and configure. &lt;p&gt;I have imported all the history from the previous Flexwiki-based wiki, however, historical versions lack proper formatting. &lt;p&gt;Unlike the previous wiki, this one requires users to be signed up in order to edit pages. This should let us avoid the wiki spam that plagued the old wiki. &lt;p&gt;Of course, it's still a bit lacking in content, but I'm sure this will pick up quickly - ScrewTurn is so much more &lt;em&gt;fun&lt;/em&gt; to work with than FlexWiki.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+New+wiki&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!204.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!204.entry</guid><pubDate>Mon, 23 Oct 2006 17:48:40 GMT</pubDate><slash:comments>8</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!204/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!204.entry#comment</wfw:comment><dcterms:modified>2006-10-23T17:48:40Z</dcterms:modified></item><item><title>Damien Guard new AnkhSVN committer</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!181.entry</link><description>&lt;p&gt;Damien Guard, more known as &lt;a href="http://www.damieng.com/blog/"&gt;DamienG&lt;/a&gt;, is a &lt;a href="http://www.damieng.com/blog/archive/2006/10/12/AnkhSVN-join.aspx"&gt;new committer on the AnkhSVN project&lt;/a&gt;. He's done some very good work for us already on redesigning the command icon set, and we look forward to working with him on new features in the post-1.0 timeframe. &lt;p&gt;The new icons will be available in the upcoming RC4. &lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Damien+Guard+new+AnkhSVN+committer&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!181.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!181.entry</guid><pubDate>Thu, 12 Oct 2006 16:51:02 GMT</pubDate><slash:comments>5</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!181/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!181.entry#comment</wfw:comment><dcterms:modified>2006-10-12T16:51:02Z</dcterms:modified></item><item><title>Powershell MSBuild task</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!180.entry</link><description>&lt;pre&gt; &lt;/pre&gt;
&lt;p&gt;I have written an MSBuild task that hosts a Powershell runspace and allows you to embed Powershell scripts in your MSBuild build files. While MSBuild ships with a large number of useful tasks (and there are also a lot of third party tasks available), there is often something you want to do which doesn't fit into the tasks provided. You can always write your own tasks to achieve what you want, but this can often become tedious to maintain since you will have to recompile and redeploy the custom task every time you need to make a little change. Having small snippets of script embedded in the MSBuild file itself can be a more easily maintainable solution, and what better language for this than Powershell?
&lt;p&gt;As a custom task, the Powershell task needs to be loaded into your build file with the &amp;lt;UsingTask&amp;gt; element:
&lt;p&gt;&lt;tt&gt;&amp;lt;UsingTask AssemblyFile=&amp;quot;PowershellMSBuildTask.dll&amp;quot; TaskName =&amp;quot;Powershell&amp;quot;/&amp;gt;&lt;/tt&gt;
&lt;p&gt;Since tasks in MSBuild don't have access to the contents of their tags, the scripts themselves need to be MSBuild properties, declared in a &amp;lt;PropertyGroup&amp;gt;:
&lt;p&gt;&lt;pre&gt;&amp;lt;PropertyGroup&amp;gt; 
	&amp;lt;HelloWorldScript&amp;gt;Write-Host &amp;quot;Hello world&amp;quot;&amp;lt;/HelloWorldScript&amp;gt; 
&amp;lt;/PropertyGroup&amp;gt;&lt;/pre&gt;
&lt;p&gt;Now, to invoke this script, you will use the Powershell task and invoke it from within a target. You reference the script property the same way you reference any other MSBuild script property: &lt;pre&gt;&amp;lt;Target Name=&amp;quot;HelloWorld&amp;quot;&amp;gt;
  &amp;lt;Powershell Script=&amp;quot;$(HelloWorldScript)&amp;quot;/&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;p&gt; The full MSBuild file will now be something like this:
&lt;p&gt;&lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;
&amp;lt;Project DefaultTargets=&amp;quot;HelloWorld&amp;quot; xmlns=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&amp;gt;
	&amp;lt;UsingTask AssemblyFile=&amp;quot;PowershellMSBuildTask.dll&amp;quot; TaskName =&amp;quot;Powershell&amp;quot;/&amp;gt;

	&amp;lt;PropertyGroup&amp;gt; 
		&amp;lt;HelloWorldScript&amp;gt;Write-Host &amp;quot;Hello world&amp;quot;&amp;lt;/HelloWorldScript&amp;gt; 
	&amp;lt;/PropertyGroup&amp;gt;

	&amp;lt;Target Name=&amp;quot;HelloWorld&amp;quot;&amp;gt;
		&amp;lt;Powershell Script=&amp;quot;$(HelloWorldScript)&amp;quot;/&amp;gt;
	&amp;lt;/Target&amp;gt;
&amp;lt;/Project&amp;gt;&lt;/pre&gt;
&lt;p&gt;Save it as HelloWorld.proj, place PowershellMSBuildTask.dll in the same directory and run it like this:
&lt;p&gt;&lt;pre&gt;msbuild HelloWorld.proj&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;The output should be as follows:
&lt;p&gt;&lt;pre&gt;PS D:\tmp&amp;gt; msbuild HelloWorld.proj
Microsoft (R) Build Engine Version 2.0.50727.42
[Microsoft .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation 2005. All rights reserved.
Build started 13.09.2006 19:02:21.
__________________________________________________
Project &amp;quot;D:\tmp\HelloWorld.proj&amp;quot; (default targets):
Target HelloWorld:
    Hello world
Build succeeded.
    0 Warning(s)
    0 Error(s)
Time Elapsed 00:00:05.09&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;Not horribly exciting, but it works.
&lt;p&gt;Of course, such a task would have limited usefullness if there wasn't a way to pass arguments from MSBuild into the custom script. The Powershell task has two ways of doing this.
&lt;p&gt;The first way is an attribute 'Arguments'. This takes in named arguments on the form 'varname1=value1;varname2=value2'. varname1 and varname2 will then be available as string variables inside the script. For example: 
&lt;p&gt;&lt;pre&gt;    &amp;lt;PropertyGroup&amp;gt;
        &amp;lt;HelloArgumentsScript&amp;gt;&amp;lt;![CDATA[
        Write-Host (&amp;quot;{0}&amp;quot; -f (([int]$value1) + ([int]$value2)))
        ]]&amp;gt;&amp;lt;/HelloArgumentsScript&amp;gt;
    &amp;lt;/PropertyGroup&amp;gt;

    &amp;lt;Target Name=&amp;quot;HelloArguments&amp;quot;&amp;gt;
        &amp;lt;Powershell Script=&amp;quot;$(HelloArgumentsScript)&amp;quot; Arguments=&amp;quot;value1=40;value2=2&amp;quot;/&amp;gt;
    &amp;lt;/Target&amp;gt;&lt;/pre&gt;&lt;pre&gt; &lt;/pre&gt;
&lt;p&gt;The output is as expected:
&lt;p&gt;&lt;pre&gt;Project &amp;quot;D:\tmp\HelloWorld.proj&amp;quot; (HelloArguments target(s)):
Target HelloArguments:
    42
Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:02.78&lt;/pre&gt;&lt;pre&gt; &lt;/pre&gt;
&lt;p&gt;The other way is through the task attribute 'TaskItems'. As the name implies, this takes in a set of taskitem objects. They are available in the Powershell script as a collection of ITaskItem objects named $TaskItems:   
&lt;p&gt;&lt;pre&gt;&amp;lt;PropertyGroup&amp;gt;
    &amp;lt;TaskItemsScript&amp;gt; &amp;lt;![CDATA[ Write-Host (&amp;quot;The answer is {0}&amp;quot; -f (([int]$taskitems[0].ItemSpec) + ([int]$taskitems[1].ItemSpec))) ]]&amp;gt; &amp;lt;/TaskItemsScript&amp;gt;
&amp;lt;/PropertyGroup&amp;gt;
&amp;lt;PropertyGroup&amp;gt;
    &amp;lt;Argument1&amp;gt;12&amp;lt;/Argument1&amp;gt;
    &amp;lt;Argument2&amp;gt;30&amp;lt;/Argument2&amp;gt;
&amp;lt;/PropertyGroup&amp;gt;&lt;/pre&gt;&lt;pre&gt;
&amp;lt;Target Name=&amp;quot;TaskItems&amp;quot;&amp;gt;
    &amp;lt;Powershell Script=&amp;quot;$(TaskItemsScript)&amp;quot; TaskItems=&amp;quot;$(Argument1);$(Argument2)&amp;quot;&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;p&gt;It is also possible for a script to return values to the calling task. This happens through the Output taskparameter, and works like this:
&lt;p&gt;&lt;pre&gt;&amp;lt;Powershell Script=&amp;quot;$(ValueReturningScript)&amp;quot;&amp;gt;
    &amp;lt;Output TaskParameter=&amp;quot;Output&amp;quot; PropertyName=&amp;quot;ScriptOutput&amp;quot;/&amp;gt;
&amp;lt;/Powershell&amp;gt;

&amp;lt;Message Lines=&amp;quot;$(ScriptOutput)&amp;quot;/&amp;gt;&lt;/pre&gt;&lt;pre&gt; &lt;/pre&gt;
&lt;p&gt;The source code can be found in a Subversion repository &lt;a href="http://ankhsvn.com/svn/powershell/trunk/PowershellMSBuildTask"&gt;here&lt;/a&gt;, and a downloadable zip including both source and the prebuilt task can be found &lt;a href="http://ankhsvn.com/images/PowershellMSBuildTask.zip"&gt;here.&lt;/a&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;blockquote&gt;&lt;/blockquote&gt;&lt;pre&gt;&lt;/pre&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Powershell+MSBuild+task&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>Powershell</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!180.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!180.entry</guid><pubDate>Wed, 13 Sep 2006 15:35:25 GMT</pubDate><slash:comments>12</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!180/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!180.entry#comment</wfw:comment><dcterms:modified>2006-09-13T17:35:28Z</dcterms:modified></item><item><title>Losing faith</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!172.entry</link><description>&lt;p&gt;(Also posted as a reply to a post on our mailing list, &lt;a href="mailto:users@ankhsvn.hm.hm"&gt;users@ankhsvn.hm.hm&lt;/a&gt;) &lt;p&gt;Gah. I'm starting to lose my faith in my fellow programmers. A little background: &lt;p&gt;Ankh uses a couple of hash tables to map EnvDTE.Project and EnvDTE.ProjectItem objects (these are from the VS automation model) representing projects and (doh) their project items to our internal objects representing the same artifacts. These hash tables are used extensively when gathering SVN resources to determine whether commands should be enabled and to provide input to the execution of said commands. In other words, when a command is invoked, the hash tables are queried for our internal objects corresponding to the currently selected ProjectItem or Project. &lt;p&gt;So, if this mechanism fails, commands won't be enabled in the first place, and if they were, they wouldn't execute correctly since no resources had been harvested. &lt;p&gt;And this mechanism will obviously fail if the hash codes retrieved from the Project and ProjectItem objects are different each time they are retrieved using GetHashCode(). &lt;p&gt;I'll leave the rest of this horror story to the imagination of the reader. I will not reveal the particular type of project that is committing this atrocity; suffice it to say that the common name for it starts with an R and ends with -eport Server Project.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Losing+faith&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!172.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!172.entry</guid><pubDate>Thu, 07 Sep 2006 20:56:39 GMT</pubDate><slash:comments>11</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!172/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!172.entry#comment</wfw:comment><dcterms:modified>2006-09-07T20:59:21Z</dcterms:modified></item><item><title>Debugging more events</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!171.entry</link><description>&lt;p&gt;A couple of months ago, I &lt;a href="http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!114.entry"&gt;posted a class&lt;/a&gt; that used the new DynamicMethod class in .NET to dynamically hook up events to all events declared on an object and display a string in VS' output pane whenever that event is raised. While quite useful, it has some drawbacks; most importantly, if you are doing this to multiple objects of the same or similar type (think multiple controls, all of which share a large number of events), it's &lt;em&gt;very&lt;/em&gt; hard to see which particular object the event is coming from.  &lt;p&gt;In some cases, you might also want to hook up only a particular event or set of events on a class, or exclude certain events. For example, all the Mouse-related events (MouseEnter, MouseMove, MouseLeave) can quickly clog up your output and hide the information you are looking for. &lt;p&gt;With this in mind, I decided to make a better version of this method. The new version is vastly improved: &lt;ul&gt; &lt;li&gt;It now supports a filter string which lets you specify a regex that has to match the name of the event(s) you are after  &lt;li&gt;It now supports a custom format string which lets you output a lot of relevant information whenever the event is raised&lt;/ul&gt; &lt;p&gt;The filter string can be used like this: &lt;p&gt;&lt;tt&gt;DebugUtils.DebugEvents(someControl, null, &amp;quot;.*Changed&amp;quot;); // only monitor the *Changed events on the control (think databinding events)&lt;/tt&gt; &lt;p&gt;That's pretty much all there is to the filter string, if you know your regular expressions. The format string is a little more involved, though. It supports the following special keywords (yeah, I stole some of these from the VS 2005 tracepoint syntax, so sue me...): &lt;ul&gt; &lt;li&gt;&lt;tt&gt;$EVENT&lt;/tt&gt; - Replaced with the name of the event raised (you almost always want this one).  &lt;li&gt;&lt;tt&gt;$TYPE&lt;/tt&gt; - Replaced with the fully qualified type name of the object raising the event.  &lt;li&gt;&lt;tt&gt;$TIMESTAMP&lt;/tt&gt; - Replaced with the current time.  &lt;li&gt;&lt;tt&gt;$CALLER&lt;/tt&gt; - Replaced with the fully qualified method name (and possibly line number if symbols are available) of the method that raised the event.  &lt;li&gt;&lt;tt&gt;$STACKTRACE&lt;/tt&gt; - Replaced with a full stack trace of the code that eventually raised the event in question.&lt;/ul&gt; &lt;p&gt;You probably don't want to use the last one unless you also have some filtering on the events (or very few events on the object to begin with); it generates a &lt;em&gt;lot &lt;/em&gt;of output. However, it can often be very useful if you need to see why a particular event is being raised. Line numbers and file names will be included if debug symbols are available. &lt;p&gt;In addition to the special keywords, it can also evaluate simple property and field expressions on the two arguments passed into the event. These are designated as &amp;quot;&lt;tt&gt;sender&lt;/tt&gt;&amp;quot; and &amp;quot;&lt;tt&gt;e&lt;/tt&gt;&amp;quot;, respectively (as is the custom for naming event arguments in .NET). For example: &lt;p&gt;&lt;tt&gt;DebugUtils.DebugEvents(this.reportsListView, &amp;quot;$TIMESTAMP: $EVENT raised, e.InvalidRect is {e.Invalidrect}&amp;quot;, &amp;quot;Invalidated&amp;quot;);&lt;/tt&gt; &lt;p&gt;Which prints the following output to VS' Output Pane: &lt;p&gt;&lt;pre&gt;22:53:32.995125: Invalidated raised, e.InvalidRect is {X=0,Y=0,Width=627,Height=269}
22:53:33.010750: Invalidated raised, e.InvalidRect is {X=0,Y=0,Width=627,Height=269}
22:53:39.932625: Invalidated raised, e.InvalidRect is {X=0,Y=0,Width=627,Height=269}
&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;(etc...) 
&lt;p&gt;The source for this file can be found in the SVN repository at &lt;a href="http://ankhsvn.com/svn/Utils/trunk/Utils/Debugging/DebugUtils.cs"&gt;http://ankhsvn.com/svn/Utils/trunk/Utils/Debugging/DebugUtils.cs&lt;/a&gt;, and unit tests: &lt;a href="http://ankhsvn.com/svn/Utils/trunk/UtilsTest/Debugging/DebugUtilsTest.cs"&gt;http://ankhsvn.com/svn/Utils/trunk/UtilsTest/Debugging/DebugUtilsTest.cs&lt;/a&gt;. To use it for yourself, either copy the file as is or check out the entire VS 2005 project from &lt;a href="http://ankhsvn.com/svn/Utils/trunk/"&gt;http://ankhsvn.com/svn/Utils/trunk/&lt;/a&gt; and build it. The class is made available under a &lt;a href="http://ankhsvn.com/svn/Utils/trunk/LICENSE.txt"&gt;slightly modified MIT license&lt;/a&gt; (I removed the clause requiring derivatives to carry the notice). 
&lt;p&gt;UPDATE: I've removed the use of the ListUtils class so that people who want to copy the file in itself won't need to also get the ListUtils class. I've also added XML doc comments to the various overloads.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Debugging+more+events&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>.NET</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!171.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!171.entry</guid><pubDate>Wed, 06 Sep 2006 21:10:23 GMT</pubDate><slash:comments>4</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!171/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!171.entry#comment</wfw:comment><dcterms:modified>2006-09-07T17:04:37Z</dcterms:modified></item><item><title>AnkhSVN 1.0 RC3 released</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!168.entry</link><description>&lt;p&gt;Following the release of Subversion 1.4 RC5, we have released a new release candidate of AnkhSVN linked against the Subversion 1.4 RC5 libraries. This Subversion release candidate fixes a bug in Subversion that was triggered by our &amp;quot;Add Solution To Subversion Repository&amp;quot; command and that caused Visual Studio to crash. Other than that, the only change to Ankh itself is support for VS 2005 web projects in the same command. Previously, they would not be detected and you would get the &amp;quot;The following projects are not under the solution root&amp;quot; message even if said web projects actually were under the solution root. &lt;p&gt;Download from &lt;a href="http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315"&gt;http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+AnkhSVN+1.0+RC3+released&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!168.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!168.entry</guid><pubDate>Sat, 26 Aug 2006 11:06:32 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!168/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!168.entry#comment</wfw:comment><dcterms:modified>2006-08-26T11:06:32Z</dcterms:modified></item><item><title>Oops</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!161.entry</link><description>&lt;p&gt; &lt;p&gt;/me sighs. &lt;p&gt;Ok, I screwed up. Due to a braino and a particularly brain dead &amp;quot;feature&amp;quot; of our build script, the MSI wasn't built from the release branch. It was instead built from a short-lived branch I created to integrate our build process with Subversion 1.4. The released MSI is pretty close to what was supposed to have been released (which is of course why I didn't discover this ;-), but lacks some bug fixes made in the last day. &lt;p&gt;An updated MSI can be found at &lt;a href="http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315"&gt;the same URL&lt;/a&gt; as the other one.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Oops&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!161.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!161.entry</guid><pubDate>Wed, 16 Aug 2006 18:12:43 GMT</pubDate><slash:comments>8</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!161/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!161.entry#comment</wfw:comment><dcterms:modified>2006-08-16T19:02:48Z</dcterms:modified></item><item><title>AnkhSVN 1.0 release candidate available</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!160.entry</link><description>&lt;p&gt;An AnkhSVN 1.0 release candidate is now available at &lt;a href="http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315"&gt;http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=7315&lt;/a&gt;. This is linked to Subversion 1.4 rc4, Berkeley DB 4.4.20, OpenSSL 0.9.8a, Neon 0.25.5 and Zlib 1.2.3.  &lt;p&gt;Note that any application linked to Subversion 1.4 (including the Ankh release candidate) will silently and irrevocably upgrade your working copies to a new working copy format. Use of such an application together with a pre-1.4 client will not work. The TortoiseSVN project makes a 1.4-compatible client available at &lt;a href="http://tortoisesvn.net/downloads"&gt;http://tortoisesvn.net/downloads&lt;/a&gt;. 1.4-compatible versions of the svn binaries can be found with the AnkhSVN release candidate.  &lt;p&gt;Also, the release candidate is linked to Berkeley DB 4.4. If you are using a local (file://) BDB repository with Ankh, it will need to be upgraded. Our general recommendation is to avoid the use of BDB for file:// access in favour of FSFS repositories.  &lt;p&gt;Changes since 0.5.5:  &lt;ul&gt; &lt;li&gt;Internal diff no longer shows duplicates  &lt;p&gt; &lt;li&gt;Fix a memory leak in the NSvn.Core.Pool class  &lt;li&gt;Clicking the X in the commit dialog now performs a cancel, regardless of whether the most recent action was a cancel or not  &lt;li&gt;NSvn exceptions are now serializable  &lt;li&gt;Commit dialog now supports Ctrl-Enter for proceeding with a commit  &lt;li&gt;Commit dialog text control now supports Ctrl-A to select the whole text  &lt;li&gt;NSvn.Core.Client.Delete now supports the 'force' parameter... :-/  &lt;li&gt;Status icons in the solution explorer are no longer overwritten by VSS ones  &lt;li&gt;Configuration dialog has templates for the most common diff and merge tools  &lt;li&gt;Individual project items can now be refreshed with the Ankh-&amp;gt;Refresh command  &lt;li&gt;The '?' status no longer propagates up the solution explorer treeview  &lt;li&gt;New projects are now automatically SVN-added if they are versionable  &lt;li&gt;Add Solution To Subversion Repository now warns the user if some projects are not under the solution root  &lt;li&gt;New configuration dialog  &lt;li&gt;Config file changes are picked up without having to restart VS  &lt;li&gt;Fix for a memory leak in the solution explorer  &lt;li&gt;Redesigned delete support  &lt;li&gt;Support for the VS refresh button  &lt;li&gt;Fix for a problem in which a premature solution explorer refresh after a folder add terminates the rename of the newly added folder and forces it to be named &amp;quot;NewFolder1&amp;quot;.  &lt;li&gt;We now call svn_utf_initialize so that iconv SOs don't have to be loaded for every SVN error message.  &lt;li&gt;Workaround for Windows Workflow Foundations beta 2 bug  &lt;li&gt;GDI handle leak plugged  &lt;li&gt;All dialogs now invariably support standard Enter/Esc for OK/Cancel  &lt;li&gt;Blame now works correctly on compound items  &lt;li&gt;Use Visual Studio SDK for better VS integration  &lt;li&gt;The commit dialog can now be suppressed with the Shift key, like other dialogs  &lt;li&gt;Support for alternative names for the SVN administrative directory now uses the functionality offered by SVN itself  &lt;li&gt;New &amp;quot;Working Copy Explorer&amp;quot; tool window  &lt;li&gt;Better support for renames and moves  &lt;li&gt;Redesigned VS integration to take advantage of the Visual Studio SDK  &lt;li&gt;Better unicode support for log messages  &lt;li&gt;Support for VS 2005 solution folders  &lt;li&gt;Dialog tab order fixes  &lt;li&gt;New installer using WiX instead of the VS.NET setup projects  &lt;li&gt;Fix bug in which Ankh would refuse to load if VC++ wasn't installed  &lt;li&gt;Prevent .svn dir from being autoadded  &lt;li&gt;Support rename on folders in projects  &lt;li&gt;Prevent Ankh from autoadding ignored files  &lt;li&gt;Prevent the solution explorer from repainting itself while Ankh is scanning the tree, improving solution load performance  &lt;li&gt;Running of SVN commands from the VS command line is now streamy  &lt;li&gt;New command that lets user send a suggestion or error report without actually experiencing an error  &lt;li&gt;Diff/Patch uses path relative to the solution directory  &lt;li&gt;Better support for third party project types  &lt;li&gt;Support commits on working copies created from multiple repositories  &lt;li&gt;Commit dialog is now &amp;quot;pseudomodal&amp;quot;, allowing the user to diff or view files using VS directly  &lt;li&gt;Ankh no longer loads on command line builds that use /rebuild or /clean  &lt;li&gt;Support for blame  &lt;li&gt;Diff/patch between arbitrary revisions  &lt;li&gt;Use the correct name for the Tools menu in non-english versions of VS  &lt;li&gt;Support for log  &lt;li&gt;Better support for file deletions  &lt;li&gt;More intelligent status cache, improving performance (especially in pathological cases)  &lt;li&gt;Support for VS 2005  &lt;li&gt;Error reports contains the DTE version (and thus implicitly the version of VS)  &lt;li&gt;Support for lock/unlock  &lt;li&gt;New design for the repository explorer  &lt;li&gt;Support for Enterprise Template projects  &lt;li&gt;Support for database projects  &lt;li&gt;Lots of tweaks, bug fixes and performance enhancements.  &lt;p&gt;&lt;/ul&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+AnkhSVN+1.0+release+candidate+available&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!160.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!160.entry</guid><pubDate>Tue, 15 Aug 2006 21:25:34 GMT</pubDate><slash:comments>35</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!160/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!160.entry#comment</wfw:comment><dcterms:modified>2006-08-16T16:48:04Z</dcterms:modified></item><item><title>Ok, maybe not this weekend, then</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!157.entry</link><description>&lt;p&gt;I promised a release candidate this weekend, but it looks like that won’t happen. Integrating our build process with Subversion 1.4 and Neon 0.25 took a lot more effort than expected. We’re now probably looking at either Monday or Tuesday.
&lt;p&gt;And we still haven’t quite decided on the version number…&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Ok%2c+maybe+not+this+weekend%2c+then&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!157.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!157.entry</guid><pubDate>Sun, 13 Aug 2006 20:26:51 GMT</pubDate><slash:comments>5</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!157/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!157.entry#comment</wfw:comment><dcterms:modified>2006-08-13T20:26:51Z</dcterms:modified></item><item><title>Ankh, how do I number thee?</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!151.entry</link><description>&lt;p&gt;We’ve decided to go ahead and make a new Ankh release.  A release candidate will come this weekend, and then a proper release will follow in a week if there are no major problems found. I’ve closed &lt;a href="http://ankhsvn.tigris.org/issues/show_bug.cgi?id=270"&gt;the last&lt;/a&gt; of the issues marked 0.6 in our &lt;a href="http://ankhsvn.tigris.org/servlets/ProjectIssues"&gt;issue tracker&lt;/a&gt;, so this seems like a good time to do it 
&lt;p&gt;One problem remains, though: what version number to give it? The obvious choice would be 0.6, since our last “official” release was 0.5.5. However, we’re getting sort of tired of the 0.6 marker by now, and we’re considering to maybe give it a version number of 0.7 or even higher. One person I talked to on IRC yesterday suggested 0.9 or even 1.0. 
&lt;p&gt;There are already 35 different snapshots all marked as 0.6.0.* around, and the idea is that giving it a higher version number might give a much clearer message that this is indeed a &lt;em&gt;new &lt;/em&gt;version. 
&lt;p&gt;What do you think?&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Ankh%2c+how+do+I+number+thee%3f&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!151.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!151.entry</guid><pubDate>Thu, 10 Aug 2006 18:22:21 GMT</pubDate><slash:comments>10</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!151/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!151.entry#comment</wfw:comment><dcterms:modified>2006-08-10T18:24:22Z</dcterms:modified></item><item><title>Is Ankh a dead project?</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!147.entry</link><description>&lt;p&gt;To avoid any potential confusion, I’ll start out this post by answering the question above: heck no! 
&lt;p&gt;I’m posting this because it is starting to dawn on me that there seems to be a pretty widespread perception that we are indeed a dead project.  In particular, &lt;a href="http://www.nabble.com/for-.NET--tf2058859.html"&gt;this thread&lt;/a&gt; on the Subversion users mailing list made this pretty clear.
&lt;p&gt;And of course, the reason for this is obvious. Our &lt;a href="http://ankhsvn.tigris.org"&gt;tigris.org&lt;/a&gt; front page has the following text: “The latest stable release of AnkhSVN was 0.5.5, released on August 17, 2004.” 
&lt;p&gt;Ouch.
&lt;p&gt;So it’s been nearly two years since our last “stable” release.  Why no releases since then? It’s not like there hasn’t been active development on it since. We’ve added tons of new features, gained VS 2005 compatibility and fixed lots and lots of bugs. “Snapshot” releases have been made at various intervals (the last one was yesterday), exposing users to the new features.
&lt;p&gt;As I see it, there are primarily two reasons we never made an “official” release. First, most of the users we interact directly with are those who use the snapshots. Whenever we talk to someone still using 0.5.5, the first thing we tell them is to try the latest snapshot instead. There’s been something of a feeling that having the snapshots available is “good enough”.
&lt;p&gt;The second is that work on Ankh, while it has never been dormant, has always been something of a fire-and-movement exercise. Every now and then, life and work interferes with Ankh development, and by the time I get back to it, there’s always a feeling of “well, we should at least fix this bug before a release” or “this feature needs to go in before we can call it 0.6”. Halfway into fixing those bugs and implementing those features, life and/or work interferes again, and the cycle starts from the beginning.
&lt;p&gt;I’m starting to think this cycle needs to end.
&lt;p&gt;There is no doubt in my mind that the current snapshots are miles ahead of 0.5.5 both in features and stability. If we took yesterday’s snapshot, renamed the MSI and released it as 0.6, it would be a huge improvement over 0.5.5. And it would definitely shatter the impression that the project is abandoned. 
&lt;p&gt;Maybe we should do just that. What do other people think?&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Is+Ankh+a+dead+project%3f&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!147.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!147.entry</guid><pubDate>Tue, 08 Aug 2006 16:25:09 GMT</pubDate><slash:comments>7</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!147/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!147.entry#comment</wfw:comment><dcterms:modified>2006-08-08T16:27:12Z</dcterms:modified></item><item><title>Why Ankh isn’t an SCC provider</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!146.entry</link><description>&lt;p&gt;A question that comes up occasionally is why AnkhSVN wasn’t implemented using the Microsoft Source Code Control Interface (MSSCCI). This is a de-facto standard today for integrating source control into various IDEs and other application, so it would seem like a natural choice for integrating Subversion into the Visual Studio IDE. However, we chose to take another approach and implement AnkhSVN as a regular Visual Studio addin instead.
&lt;p&gt;Initial planning on AnkhSVN started in December of 2002. At that time, it was a school project that was supposed to last throughout the spring semester of 2003 at &lt;a href="http://www.hio.no/content/view/full/4563"&gt;Oslo University College&lt;/a&gt;. I had some clear ideas about what I wanted to do for my project: I wanted to make something open source, I wanted to relate it somehow to Subversion and I wanted to implement it using C#/.NET, since those were my interests at the time (and still are). Using MSSCCI conflicted with goals #1 and #3. In 2002, the MSSCCI API was under a strict Non-Disclosure Agreement, meaning we wouldn’t have been able to make something open source if we were to use it. There was also a rumor going around that getting hold of the right person inside Microsoft in order to obtain the documentation for the API and sign the NDA was something of a Kafkaesque quest. Since we didn’t attempt to go down this route, I never did find out whether this was true.
&lt;p&gt;Another problem with MSSCCI is that it is essentially a specification for a number of exported C functions from a DLL. At that time I had dabbled with C#/.NET for a while and wanted to try it out for a major project. A .NET assembly cannot (easily, there are ways…) export regular functions, so implementing an MSSCCI provider using .NET would prove to be rather awkward. The technical problems here aren’t insurmountable, however, I can easily think of some ways in which we could have made Ankh using MSSCCI and still got to write most parts of it in .NET. If there hadn’t been other reasons for not using MSSCCI, this problem alone wouldn’t have caused us to make the choice we did. If MSSCCI had been the best choice, it’s also quite possible that we would have implemented the whole thing in C++ instead.
&lt;p&gt;MSSCCI, unfortunately, has one more major problem: it’s not a very good API. It is more or less designed around the needs of Visual Sourcesafe, and source control systems that don’t subscribe to the same ideology as VSS plain don’t fit very well into it. Eric Sink (founder of Sourcegear, which makes the &lt;a href="http://www.sourcegear.com/vault/"&gt;Vault&lt;/a&gt; source control system) , in his excellent series &lt;a href="http://software.ericsink.com/scm/source_control.html"&gt;Source Control HOWTO&lt;/a&gt;, writes about MSSCCI’s deficiencies in &lt;a href="http://software.ericsink.com/scm/scm_ide_integration.html"&gt;Chapter 9: Source Control Integration with IDEs&lt;/a&gt;. Which is good, because then I don’t have to go on about it here.
&lt;p&gt;We already knew about most of the criticisms leveraged at MSSCCI back when we were planning the project, so it proved to be the final and decisive argument against using it for Ankh.&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+Why+Ankh+isn%e2%80%99t+an+SCC+provider&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>AnkhSVN</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!146.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!146.entry</guid><pubDate>Thu, 03 Aug 2006 15:12:27 GMT</pubDate><slash:comments>6</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!146/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!146.entry#comment</wfw:comment><dcterms:modified>2006-08-03T15:12:27Z</dcterms:modified></item><item><title>DynamicMethod revisited: Making Powershell handle arbitrary delegates</title><link>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!144.entry</link><description>&lt;p&gt;
 &lt;p&gt;As I posted on &lt;a href="http://arildf.spaces.msn.com/blog/cns!E99F8B43533149B0!140.entry?_c11_blogpart_blogpart=blogview&amp;amp;_c=blogpart"&gt;Monday&lt;/a&gt;, Powershell doesn’t let you cast a scriptblock to a delegate with a signature other than void (Object, Object). Jeffrey Snover &lt;a href="http://blogs.msdn.com/powershell/archive/2006/07/24/Casting_a_scriptblock_to_an_arbitrary_delegate_signature.aspx"&gt;confirmed&lt;/a&gt; this the same day. When I learned that this was a limitation in v1.0 of Powershell, I set out to find a way to get around this problem using .NET’s DynamicMethod class. 
&lt;p&gt;I mostly got it done yesterday, but I was feeling a bit tired and didn’t finish it so I could blog about it. Today I see that the Powershell team has posted a &lt;a href="http://blogs.msdn.com/powershell/archive/2006/07/25/678259.aspx"&gt;workaround of their own&lt;/a&gt;, which is remarkably similar to mine. Although, theirs probably gets extra coolness points since it’s written in Powershell itself and not implemented as a cmdlet like mine.
&lt;p&gt;Anyway, I have now finished it and decided to post it anyway (I spent quite a lot of time on it, mostly silly mistakes on my part). Here goes:
&lt;p&gt;
&lt;span&gt;&lt;span&gt;using&lt;/span&gt;&lt;span&gt; &lt;/span&gt;System&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;using&lt;/span&gt;&lt;span&gt; &lt;/span&gt;System&lt;span&gt;.&lt;/span&gt;Collections&lt;span&gt;.&lt;/span&gt;Generic&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;using&lt;/span&gt;&lt;span&gt; &lt;/span&gt;System&lt;span&gt;.&lt;/span&gt;Text&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;using&lt;/span&gt;&lt;span&gt; &lt;/span&gt;System&lt;span&gt;.&lt;/span&gt;Management&lt;span&gt;.&lt;/span&gt;Automation&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;using&lt;/span&gt;&lt;span&gt; &lt;/span&gt;System&lt;span&gt;.&lt;/span&gt;Reflection&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;using&lt;/span&gt;&lt;span&gt; &lt;/span&gt;System&lt;span&gt;.&lt;/span&gt;Reflection&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;using&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Fines&lt;span&gt;.&lt;/span&gt;Utils&lt;span&gt;.&lt;/span&gt;Collections&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;namespace&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Fines&lt;span&gt;.&lt;/span&gt;ConvertScriptBlockSnapin&lt;br&gt;
&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;    &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;Cmdlet&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;Convert&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;ScriptBlock&amp;quot;&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;br&gt;
&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ConvertScriptBlockCommand&lt;span&gt; &lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Cmdlet&lt;br&gt;
&lt;span&gt;    &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;Parameter&lt;span&gt;(&lt;/span&gt;Mandatory&lt;span&gt;=&lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Position&lt;span&gt;=&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt; &lt;/span&gt;DelegateTypeName&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;get&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;delegateTypeName&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;set&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;delegateTypeName&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;value&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;Parameter&lt;span&gt;(&lt;/span&gt;Mandatory&lt;span&gt;=&lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Position&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlock&lt;span&gt; &lt;/span&gt;ScriptBlock&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;get&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;scriptBlock&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;set&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;scriptBlock&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;value&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;Parameter&lt;span&gt;(&lt;/span&gt;Mandatory&lt;span&gt;=&lt;/span&gt;&lt;span&gt;false&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Position&lt;span&gt;=&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;SwitchParameter&lt;span&gt; &lt;/span&gt;ReturnPSObject&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;get&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;returnPSObject&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;set&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt; &lt;/span&gt;returnPSObject&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;value&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;protected&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;override&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ProcessRecord&lt;span&gt;()&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;// Validate the DelegateTypeName parameter&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;// It must be a delegate type&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;Type&lt;span&gt; &lt;/span&gt;delegateType&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;!&lt;/span&gt;LanguagePrimitives&lt;span&gt;.&lt;/span&gt;TryConvertTo&lt;span&gt;&amp;lt;&lt;/span&gt;Type&lt;span&gt;&amp;gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;DelegateTypeName&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;out&lt;/span&gt;&lt;span&gt; &lt;/span&gt;delegateType&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;Exception&lt;span&gt; &lt;/span&gt;ex&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ArgumentException&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;Type not found: &amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;DelegateTypeName&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;DelegateTypeName&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;base&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;ThrowTerminatingError&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ErrorRecord&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ex&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;TypeNotFound&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ErrorCategory&lt;span&gt;.&lt;/span&gt;InvalidType&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;span&gt;         &lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;Delegate&lt;span&gt;).&lt;/span&gt;IsAssignableFrom&lt;span&gt;(&lt;/span&gt;delegateType&lt;span&gt;))&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;Exception&lt;span&gt; &lt;/span&gt;ex&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ArgumentException&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;DelegateTypeName must be of a delegate type. Found &amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;DelegateTypeName&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;&amp;quot;DelegateTypeName&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;base&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;ThrowTerminatingError&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ErrorRecord&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ex&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;TypeNotDelegate&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ErrorCategory&lt;span&gt;.&lt;/span&gt;InvalidType&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Delegate&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;==&lt;/span&gt;&lt;span&gt; &lt;/span&gt;delegateType&lt;span&gt; &lt;/span&gt;&lt;span&gt;||&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;MulticastDelegate&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;==&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;delegateType&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;Exception&lt;span&gt; &lt;/span&gt;ex&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ArgumentException&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;DelegateTypeName cannot be of type System.Delegate or System.MulticastDelegate&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;&amp;quot;DelegateTypeName&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;base&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;ThrowTerminatingError&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ErrorRecord&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ex&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;TypeSystemDelegate&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ErrorCategory&lt;span&gt;.&lt;/span&gt;InvalidType&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;// Create our trampoline and write it to the pipeline&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;ScriptBlockTrampoline&lt;span&gt; &lt;/span&gt;tramp&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlockTrampoline&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;ScriptBlock&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;ReturnPSObject&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;WriteObject&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;tramp&lt;span&gt;.&lt;/span&gt;CreateDelegate&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;delegateType&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;/// This class exists to attach state (the scriptblock and the switch parameter) to the dynamic method&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;/// we create.&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlockTrampoline&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlockTrampoline&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlock&lt;span&gt; &lt;/span&gt;scriptBlock&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;SwitchParameter&lt;span&gt; &lt;/span&gt;returnPSObject&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;scriptBlock&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;scriptBlock&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;returnPSObject&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;returnPSObject&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Delegate&lt;span&gt; &lt;/span&gt;CreateDelegate&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Type&lt;span&gt; &lt;/span&gt;delegateType&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;MethodInfo&lt;span&gt; &lt;/span&gt;invokeMethod&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;delegateType&lt;span&gt;.&lt;/span&gt;GetMethod&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;Invoke&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// get the parameter types of the delegate&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;Type&lt;span&gt;[]&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ListUtils&lt;span&gt;.&lt;/span&gt;ToArray&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;ListUtils&lt;span&gt;.&lt;/span&gt;Map&lt;span&gt;&amp;lt;&lt;/span&gt;ParameterInfo&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Type&lt;span&gt;&amp;gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;invokeMethod&lt;span&gt;.&lt;/span&gt;GetParameters&lt;span&gt;(),&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;delegate&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ParameterInfo&lt;span&gt; &lt;/span&gt;par&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;                        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;par&lt;span&gt;.&lt;/span&gt;ParameterType&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// the first arg needs to be of type ScriptBlockTrampoline so we can treat it as an instance method&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;Type&lt;span&gt;[]&lt;/span&gt;&lt;span&gt; &lt;/span&gt;parmTypes&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;Type&lt;span&gt;[&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt;.&lt;/span&gt;Length&lt;span&gt; &lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;parmTypes&lt;span&gt;[&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlockTrampoline&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;Array&lt;span&gt;.&lt;/span&gt;Copy&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;parmTypes&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt;.&lt;/span&gt;Length&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// Associate our dynamic method with the ScriptBlockTrampoline class so it can access its privates&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;DynamicMethod&lt;span&gt; &lt;/span&gt;dm&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;DynamicMethod&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;Dele&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;invokeMethod&lt;span&gt;.&lt;/span&gt;ReturnType&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;parmTypes&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlockTrampoline&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;ILGenerator&lt;span&gt; &lt;/span&gt;g&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;dm&lt;span&gt;.&lt;/span&gt;GetILGenerator&lt;span&gt;();&lt;/span&gt;&lt;span&gt;                &lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// Create a local to hold our params array&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;LocalBuilder&lt;span&gt; &lt;/span&gt;arrayLocal&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;DeclareLocal&lt;span&gt;(&lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;object&lt;/span&gt;&lt;span&gt;[]));&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// create the array with our desired length&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ldc_I4&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt;.&lt;/span&gt;Length&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Newarr&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;object&lt;/span&gt;&lt;span&gt;));&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// store it in our local&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Stloc&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;arrayLocal&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// load our params into it&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;for&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt; &lt;/span&gt;i&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;i&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt;.&lt;/span&gt;Length&lt;span&gt;;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;i&lt;span&gt;++)&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ldloc&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;arrayLocal&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;// the index in the array in which we want to store the element&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ldc_I4&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;i&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;// load the arg onto the stack&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ldarg&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;i&lt;span&gt; &lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;// 'this' is arg 0&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;// if it's a value type, we need to box&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt;[&lt;/span&gt;&lt;span&gt; &lt;/span&gt;i&lt;span&gt; &lt;/span&gt;&lt;span&gt;].&lt;/span&gt;IsValueType&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                        &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Box&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;baseMethodParmTypes&lt;span&gt;[&lt;/span&gt;&lt;span&gt; &lt;/span&gt;i&lt;span&gt; &lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;// and store it in the array&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Stelem&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;object&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                 &lt;/span&gt;&lt;span&gt;//get the scriptblock field&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ldarg&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ldfld&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlockTrampoline&lt;span&gt; &lt;/span&gt;&lt;span&gt;).&lt;/span&gt;GetField&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;scriptBlock&amp;quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;BindingFlags&lt;span&gt;.&lt;/span&gt;NonPublic&lt;span&gt; &lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt; &lt;/span&gt;BindingFlags&lt;span&gt;.&lt;/span&gt;Instance&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;//// now emit the call to the scriptblock&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ldloc&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;arrayLocal&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;EmitCall&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Callvirt&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlock&lt;span&gt; &lt;/span&gt;&lt;span&gt;).&lt;/span&gt;GetMethod&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;InvokeReturnAsIs&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// can't have an object on the stack if we're returning void&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;invokeMethod&lt;span&gt;.&lt;/span&gt;ReturnType&lt;span&gt; &lt;/span&gt;&lt;span&gt;==&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Pop&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;else&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;// does the user want the raw object or the PSObject instance?&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;returnPSObject&lt;span&gt;.&lt;/span&gt;IsPresent&lt;span&gt; &lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                        &lt;/span&gt;&lt;span&gt;// what's returned from the ScriptBlock is a PSObject, get the underlying object instead&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                        &lt;/span&gt;MethodInfo&lt;span&gt; &lt;/span&gt;getMethod&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;typeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;PSObject&lt;span&gt; &lt;/span&gt;&lt;span&gt;).&lt;/span&gt;GetProperty&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;BaseObject&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;).&lt;/span&gt;GetGetMethod&lt;span&gt;();&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                        &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;EmitCall&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Call&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;getMethod&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                    &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;// ret is not optional&lt;/span&gt;&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;g&lt;span&gt;.&lt;/span&gt;Emit&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;OpCodes&lt;span&gt;.&lt;/span&gt;Ret&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;                &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;dm&lt;span&gt;.&lt;/span&gt;CreateDelegate&lt;span&gt;(&lt;/span&gt;&lt;span&gt; &lt;/span&gt;delegateType&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlock&lt;span&gt; &lt;/span&gt;scriptBlock&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;            &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;SwitchParameter&lt;span&gt; &lt;/span&gt;returnPSObject&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;ScriptBlock&lt;span&gt; &lt;/span&gt;scriptBlock&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt; &lt;/span&gt;delegateTypeName&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span&gt;        &lt;/span&gt;&lt;span&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;SwitchParameter&lt;span&gt; &lt;/span&gt;returnPSObject&lt;span&gt;;&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;    &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span&gt;}&lt;/span&gt;&lt;br&gt;
&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
 &lt;p&gt;The ScriptBlockTrampoline.CreateDelegate method is where most of the fun stuff happens. I create a DynamicMethod with the same signature as that of the target delegate. Since I also pass in the ScriptBlockTrampoline type to the DynamicMethod constructor, the created method will be treated as a member method on ScriptBlockTrampoline with regards to member access; in other words, it can access private members on this type. The first parameter to the DynamicMethod is a ScriptBlockTrampoline object, which means it can be treated as an instance method and have access to the scriptBlock and returnPSObject private member variables.
&lt;p&gt;Code is then emitted to create an array of type Object[], which is then loaded with the arguments passed to the delegate at the invocation point. This array is passed to the ScriptBlock’s InvokeReturnAsIs() method, which actually executes the scriptblock.
&lt;p&gt;One particular thing that caused me a lot of grief (not really sure why, I’ve encountered and solved the same problem before) was that InvokeReturnAsIs() will return an object and place it on the IL evaluation stack even if there is no actual return value and the delegate return type is void. If you don’t pop this object off the stack  (the if statement) before the RET instruction, executing the delegate will cause the .NET runtime to bail out and die since the program is invalid. I spent a lot of hours on this one.
&lt;p&gt;One other thing that bears mentioning is that InvokeReturnAsIs will actually return a PSObject, not the raw underlying object. If the code calling the method expects the actual type (i.e., if it’s called from most managed languages), things will get ugly pretty fast if it gets a PSObject instead.  Code is therefore emitted to call the PSObject.BaseMethod property.
&lt;p&gt;With this cmdlet, implementing a Powershell script for doing an “svn ls” with support for authentication becomes rather simple:
&lt;p&gt;
&lt;pre&gt;&lt;span style="color:#008000"&gt;#&lt;/span&gt;&lt;span style="color:#008000"&gt; get-svndir.ps1&lt;/span&gt;&lt;span style="color:#008000"&gt;
&lt;/span&gt;&lt;span style="color:#000000"&gt;
param ([&lt;/span&gt;&lt;span style="color:#0000FF"&gt;string&lt;/span&gt;&lt;span style="color:#000000"&gt;]&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$svnurl&lt;/span&gt;&lt;span style="color:#000000"&gt;       &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$&lt;/span&gt;&lt;span style="color:#000000"&gt;(&lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;read-host&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000080"&gt;Please specify the SVN url for the directory you want to list&lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt;)
    )

[System.Reflection.Assembly]::LoadFrom((&lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;join-Path&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000080"&gt;$env:PROGRAMFILES\AnkhSVN&lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;-&lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;childPath&lt;/span&gt;&lt;span style="color:#000000"&gt; NSvn.Common.dll)) &lt;/span&gt;&lt;span style="color:#000000"&gt;|&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;Out-Null&lt;/span&gt;&lt;span style="color:#000000"&gt;
[System.Reflection.Assembly]::LoadFrom((&lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;join-Path&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000080"&gt;$env:PROGRAMFILES\AnkhSVN&lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;-&lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;childPath&lt;/span&gt;&lt;span style="color:#000000"&gt; NSvn.Core.dll)) &lt;/span&gt;&lt;span style="color:#000000"&gt;|&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;Out-Null&lt;/span&gt;&lt;span style="color:#000000"&gt;

&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$PRIVATE:svnclient&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;new-object&lt;/span&gt;&lt;span style="color:#000000"&gt; NSvn.Core.Client 

&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$PRIVATE:simplepromptdelegate&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;convert-scriptblock&lt;/span&gt;&lt;span style="color:#000000"&gt; NSvn.Core.SimplePromptDelegate {
    &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;Write-Host&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000080"&gt;Authenticating against realm &lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$args&lt;/span&gt;&lt;span style="color:#000000"&gt;[&lt;/span&gt;&lt;span style="color:#FF0000"&gt;0&lt;/span&gt;&lt;span style="color:#000000"&gt;]
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$user&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;Read-Host&lt;/span&gt;&lt;span style="color:#000000"&gt; (&lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000080"&gt;Input username (press Enter to accept default of {0})&lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt;  &lt;/span&gt;&lt;span style="color:#000000"&gt;-&lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;f&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$args&lt;/span&gt;&lt;span style="color:#000000"&gt;[&lt;/span&gt;&lt;span style="color:#FF0000"&gt;1&lt;/span&gt;&lt;span style="color:#000000"&gt;])
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;if&lt;/span&gt;&lt;span style="color:#000000"&gt; ( &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$user&lt;/span&gt;&lt;span style="color:#000000"&gt;.Trim() &lt;/span&gt;&lt;span style="color:#0000FF"&gt;-eq&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt; ) 
    {
        &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$user&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$args&lt;/span&gt;&lt;span style="color:#000000"&gt;[&lt;/span&gt;&lt;span style="color:#FF0000"&gt;1&lt;/span&gt;&lt;span style="color:#000000"&gt;]
    }
    
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$password&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;Read-Host&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;-&lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;AsSecureString&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000080"&gt;Input password&lt;/span&gt;&lt;span style="color:#000080"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000"&gt;
    
    &lt;/span&gt;&lt;span style="color:#008000"&gt;#&lt;/span&gt;&lt;span style="color:#008000"&gt; Convert it to a plain string&lt;/span&gt;&lt;span style="color:#008000"&gt;
&lt;/span&gt;&lt;span style="color:#000000"&gt;    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$BSTR&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; [System.Runtime.InteropServices.marshal]::SecureStringToBSTR(&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$password&lt;/span&gt;&lt;span style="color:#000000"&gt;)
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$password&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; [System.Runtime.InteropServices.marshal]::PtrToStringAuto(&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$BSTR&lt;/span&gt;&lt;span style="color:#000000"&gt;)
    [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR(&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$BSTR&lt;/span&gt;&lt;span style="color:#000000"&gt;)
    
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$cred&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#FFA500;text-decoration:underline"&gt;New-Object&lt;/span&gt;&lt;span style="color:#000000"&gt; NSvn.Core.SimpleCredential(&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$user&lt;/span&gt;&lt;span style="color:#000000"&gt;, &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$password&lt;/span&gt;&lt;span style="color:#000000"&gt;, &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$False&lt;/span&gt;&lt;span style="color:#000000"&gt;)
    &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$cred&lt;/span&gt;&lt;span style="color:#000000"&gt;
}

&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$PRIVATE:svnclient&lt;/span&gt;&lt;span style="color:#000000"&gt;.AuthBaton.Add( [NSvn.Core.AuthenticationProvider]::GetWindowsSimpleProvider() )
&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$PRIVATE:svnclient&lt;/span&gt;&lt;span style="color:#000000"&gt;.AuthBaton.Add( [NSvn.Core.AuthenticationProvider]::GetSimplePromptProvider(&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$PRIVATE:simplepromptdelegate&lt;/span&gt;&lt;span style="color:#000000"&gt;, &lt;/span&gt;&lt;span style="color:#FF0000"&gt;3&lt;/span&gt;&lt;span style="color:#000000"&gt;) )
  

&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$items&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#000000"&gt;=&lt;/span&gt;&lt;span style="color:#000000"&gt; &lt;/span&gt;&lt;span style="color:#0000FF"&gt;$PRIVATE:svnclient&lt;/span&gt;&lt;span style="color:#000000"&gt;.List(&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$svnurl&lt;/span&gt;&lt;span style="color:#000000"&gt;, [NSvn.Core.Revision]::Head, [NSvn.Core.Revision]::Head, [NSvn.Common.Recurse]::None)
&lt;/span&gt;&lt;span style="color:#0000FF"&gt;$items&lt;/span&gt;&lt;/pre&gt;
 &lt;p&gt;Thanks to &lt;a href="http://mow001.blogspot.com/"&gt;/\/\o\/\/&lt;/a&gt; for pointing me to his blog post about how to convert a SecureString to a regular .NET string, which is what the SimpleCredential constructor expects.
&lt;p&gt;A sample run of that script:
&lt;blockquote&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;PS D:\mydocs\powershell&amp;gt; D:\mydocs\powershell\get-svndir.ps1 http://ankhsvn.com/svn/draco/ | ft Path,LastAuthor,Time
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;Authenticating against realm  &amp;lt;http://ankhsvn.com:80&amp;gt; Subversion repository draco
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;Input username (press Enter to accept default of Arild):
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;Input password: ****
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;Path                                    LastAuthor                              Time
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;----                                    ----------                              ----
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;trunk                                   Arild                                   16.01.2006 03:33:30
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;branches                                Arild                                   18.10.2005 21:03:32
&lt;/span&gt;&lt;p&gt;&lt;span style="color:black;font-family:Courier New;font-size:8"&gt;tags                                    Arild                                   18.10.2005 21:03:32
&lt;/span&gt;&lt;/blockquote&gt;&lt;p&gt;The snapin can be found in SVN at &lt;a href="http://ankhsvn.com/svn/powershell/trunk/ConvertScriptBlockCommand/"&gt;http://ankhsvn.com/svn/powershell/trunk/ConvertScriptBlockCommand/&lt;/a&gt;. It is also downloadable as a .zip &lt;a href="http://ankhsvn.com/images/ConvertScriptBlockCommand.zip"&gt;here&lt;/a&gt;. To install it, run install.ps1 from the root folder in &lt;a href="http://arildf.spaces.msn.com/blog/cns!E99F8B43533149B0!133.entry?_c11_blogpart_blogpart=blogview&amp;amp;_c=blogpart"&gt;a shell with the .NET environment set&lt;/a&gt;. By default, it will add the command “Add-PsSnapin ConvertScriptBlockSnapin” to your $PROFILE file after compiling and installing it if it’s not already there.
&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1612417020300539472&amp;page=RSS%3a+DynamicMethod+revisited%3a+Making+Powershell+handle+arbitrary+delegates&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=arildf.spaces.live.com&amp;amp;GT1=arildf"&gt;</description><category>Powershell</category><comments>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!144.entry#comment</comments><guid isPermaLink="true">http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!144.entry</guid><pubDate>Wed, 26 Jul 2006 17:48:44 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://arildf.spaces.live.com/blog/cns!E99F8B43533149B0!144/comments/feed.rss</wfw:commentRss><wfw:comment>http://arildf.spaces.live.com/Blog/cns!E99F8B43533149B0!144.entry#comment</wfw:comment><dcterms:modified>2006-07-26T17:48:44Z</dcterms:modified></item></channel></rss>