<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Yao's Whiteboard</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/yao/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/yao/feed.xml</link>
    <description>Tips and tricks from Zhenhua Yao</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:30:02 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Get the last build using TFS IP</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/get-the-last-build-using-tfs-ip</link>
      <pubDate>Sun, 03 Jun 2012 18:36:11 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/06/03/get-the-last-build-using-tfs-ip/</guid>
      <description><![CDATA[In the deploy-test scenario, it is often needed to find the last good build.&#160; By “last good...]]></description>
      <content:encoded><![CDATA[<p>In the deploy-test scenario, it is often needed to find the last good build.&#160; By “last good build”, we mean the most recent build for a given build definition on TFS which has been built successfully and reached a certain quality level reflected by “Build Quality” field.&#160; A common approach is to create a shortcut or junction named as “LATEST which points to the last known good build after testing, or copy the entire build drop directory.&#160; It is not very reliable because this approach is not visible by and out of sync with the team build.&#160; In the automated deployment context, Orchestrator along with TFS IP provides a simpler solution by using “Get Build Details” activity.</p>  <p>Suppose the “Build Quality” (the field is visible on Visual Studio IDE) is properly maintained by build-test process.&#160; We simply use “Get Build Details” to retrieve one build with the following parameters:</p>  <ul>   <li>Maximum builds per definition: 1.&#160; We only need one build.</li>    <li>Build Query Order: StartTimeDescending.&#160; It is the default value of this optional property.</li>    <li>Build Status: Succeeded.&#160; We only care build that is finished successfully.</li>    <li>Build Quality: fill in the value as needed.</li> </ul>  <p>Here is the screenshot:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7774.image_28BE4ED2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7774.image_5F00_28BE4ED2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/6114.image_thumb_362461D8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/6114.image_5F00_thumb_5F00_362461D8.png" width="488" height="303" /></a></p>  <p>Note that I just checked in the change today.&#160; So you will need to build the assembly by yourself and put it at C:\Program Files (x86)\Common Files\Microsoft System Center 2012\Orchestrator\Extensions\Support\Integration Toolkit\4e5fdf96-9cad-4233-8607-400288353bb6 if you want to use it right now.&#160; Otherwise you can wait for the OIP update.</p>]]></content:encoded>
    </item>
    <item>
      <title>Import test results into TFS using Orchestrator</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/import-test-results-into-tfs-using-orchestrator</link>
      <pubDate>Mon, 28 May 2012 16:10:25 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/05/28/import-test-results-into-tfs-using-orchestrator/</guid>
      <description><![CDATA[In the last post I talked about how to manually create a build record in TFS.&#160; In this post I...]]></description>
      <content:encoded><![CDATA[<p>In the <a href="https://blogs.msdn.com/b/yao/archive/2012/05/28/manually-create-a-build-record-in-tfs-using-orchestrator.aspx" target="_blank">last post</a> I talked about how to manually create a build record in TFS.&#160; In this post I will talk about how to import the test results into TFS using TFS IP.&#160; Just like we said last time, some teams have their proprietary test infrastructure, the authoring/execution/management of test cases are performed outside of TFS.&#160; In order to put all information in one place to facilitate project tracking and reporting (or for other reasons), we may want to import test case results into TFS.&#160; Powered by TFS IP, Orchestrator can do this in a straightforward way.</p>  <p>Firstly, in order to conform to the TFS/Test Manager object model, test case results have to be associated with <em>Test Cases</em> (a specialized “work item”) which are grouped into <em>Test Suite</em> which is created under a <em>Test Plan</em> in a team project.&#160; So we need to do the following:</p>  <ol>   <li>Creates test cases using either Visual Studio or Test Manager 2010.</li>    <li>Creates a test plan in the team project where test cases are stored using Test Manager 2010.</li>    <li>Creates one or more test suites under the test plan using Test Manager 2010.</li> </ol>  <p>Test Manager 2010 is quite intuitive to use, if you are not sure, refer to MSDN documentation.</p>  <p>In this example, I created “Yao Test Plan” which has one test suite called “Yao Test Suites”.&#160; There are two test cases in the test suite.&#160; Here is how it looks like in Test Manager 2010:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/8308.image_5C6ABB14.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/8308.image_5F00_5C6ABB14.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/4617.image_thumb_17BE20D3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/4617.image_5F00_thumb_5F00_17BE20D3.png" width="692" height="196" /></a></p>  <p>I want to import one test case result “test case 320598 passed” into TFS.&#160; In the real world scenario, you will have much more, but the basic steps are the same.</p>  <p>We can query all the test plans in a team project using “Get Test Plan” activity, the output is the list of Test Plan IDs:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/5661.image_7017A4A8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/5661.image_5F00_7017A4A8.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/1462.image_thumb_369494B1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/1462.image_5F00_thumb_5F00_369494B1.png" width="558" height="211" /></a></p>  <p>I am only interested in my own plan, so I filter on the test plan name:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2626.image_1A17A2D1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2626.image_5F00_1A17A2D1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/6254.image_thumb_2E9CF24F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/6254.image_5F00_thumb_5F00_2E9CF24F.png" width="570" height="218" /></a></p>  <p>Next I use “Create Test Run” to create a “Test Run” object and set Owner to “Zhenhua Yao” (Owner should not be empty).&#160; Test Run is the collection of all test case results that were executed together with a build, having a Test Run object is the prerequisite of importing test case results.&#160; Note that I use the test plan ID queried from the last activity, you can also leave it empty and fill in the “Test Plan Name” if the name is unique.&#160; Build Number usually refers to the build record in TFS (can be created by running a team build or creating a manual build), but in practice you can use any string or even leave it empty if you really don’t care the build.&#160; In this activity, you also need to specify either “test suites” and/or “test cases” (they cannot be both empty), the test cases should have a 1:1 mapping to the test case results to be imported.&#160; If a test case is not in the Test Run, you cannot use “Add Test Case Result” activity to add it, if a test case is in the Test Run but you have not imported the result, the test run is considered as uncompleted yet.&#160; In most cases, you will put a comma separate test suite IDs in this activity.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7331.image_5909236C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7331.image_5F00_5909236C.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/8715.image_thumb_145C892B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/8715.image_5F00_thumb_5F00_145C892B.png" width="570" height="360" /></a></p>  <p>After the test run is created, we can use “Add Test Case Result” activity to import the result one by one by its ID:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/0878.image_13F05636.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/0878.image_5F00_13F05636.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/0474.image_thumb_6596D088.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/0474.image_5F00_thumb_5F00_6596D088.png" width="570" height="268" /></a></p>  <p>Note that Owner field must be set.&#160; Again, if you don’t want to specify the test run ID, you can specify its title if it’s unique.</p>  <p>Once all test case results have been imported, you can use “Query Test Runs” activity to see the updated Test Run as well as the statistics.&#160; Here is the query result in the Runbook Tester:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/0871.image_373D4ADB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/0871.image_5F00_373D4ADB.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/0878.image_thumb_7290B099.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/0878.image_5F00_thumb_5F00_7290B099.png" width="374" height="412" /></a></p>  <p>The test run also shows up in the Test Manager 2010 as expected:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7318.image_2B3B5AA7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7318.image_5F00_2B3B5AA7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/8715.image_thumb_11D3576D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/8715.image_5F00_thumb_5F00_11D3576D.png" width="987" height="175" /></a></p>  <p>We can use it as any other Test Runs created by Test Manager 2010 itself:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2133.image_0A47E800.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2133.image_5F00_0A47E800.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/6232.image_thumb_7073B1D0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/6232.image_5F00_thumb_5F00_7073B1D0.png" width="1007" height="660" /></a></p>  <p>For more information about these activities, you may refer to the <a href="https://orchestrator.codeplex.com/wikipage?title=TFS%20IP%201.4%20new%20features&amp;referringTitle=Documentation" target="_blank">documentation on codeplex</a> or just try it by yourself.&#160; If you have questions or any feature request, please let me know.</p>]]></content:encoded>
    </item>
    <item>
      <title>Manually create a build record in TFS using Orchestrator</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/manually-create-a-build-record-in-tfs-using-orchestrator</link>
      <pubDate>Mon, 28 May 2012 10:20:37 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/05/28/manually-create-a-build-record-in-tfs-using-orchestrator/</guid>
      <description><![CDATA[Not every team uses TFS for both source repository and build automation, even in Microsoft.&#160;...]]></description>
      <content:encoded><![CDATA[<p>Not every team uses TFS for both source repository <em>and</em> build automation, even in Microsoft.&#160; Some teams maintain their custom build tool (a.k.a “manual build”) which means the build information is not tracked by TFS, but at the same time they want to use Test Manager or import test case results into TFS.&#160; In order to keep things consistent, it is necessary to have a build record TFS for the manual build.&#160; For instance, we may want to know what build is used for producing a test run.</p>  <p>Programmatically, this can be done by <a href="https://msdn.microsoft.com/en-us/library/ff738420.aspx" target="_blank">IBuildDefinition.CreateManualBuild</a> API.&#160; If you don’t want to write your own code, you may use TFS IP to do this.</p>  <p>Since a build record must be associated with a build definition, we have to create a build definition in the team project using Visual Studio:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/4477.image_563F9940.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/4477.image_5F00_563F9940.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7510.image_thumb_7C354996.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7510.image_5F00_thumb_5F00_7C354996.png" width="258" height="252" /></a></p>  <p>This does not need to be a completely valid build, since it’s for tracking purpose.&#160; For instance, you can leave the “Items to Build” in Process tab empty, it will be fine.&#160; Suppose it is called “Manual_Build” in Sandbox team project.&#160; Now we want to create a manual build with build number “Custom Build 1.2.3.4 20120508”, then create a runbook and drag “Create Manual Build” to the workspace:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/6038.image_3473C0AF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/6038.image_5F00_3473C0AF.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/1643.image_thumb_41D9D3B5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/1643.image_5F00_thumb_5F00_41D9D3B5.png" width="609" height="409" /></a></p>  <p>There are also some optional properties in this activity.&#160; You may choose whatever relevant to your project.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/3312.image_27996A91.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/3312.image_5F00_27996A91.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/0576.image_thumb_402907E1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/0576.image_5F00_thumb_5F00_402907E1.png" width="150" height="175" /></a></p>      <p>Note that the service account user has to have the permission to “Update build information”,</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/6433.image_4D8F1AE7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/6433.image_5F00_4D8F1AE7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7115.image_thumb_173DF2D8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7115.image_5F00_thumb_5F00_173DF2D8.png" width="653" height="699" /></a></p>  <p>Once the runbook is executed, the new build record will be created and be visible in Visual Studio:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/6445.image_2437D2E9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/6445.image_5F00_2437D2E9.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/4885.image_thumb_03B09337.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/4885.image_5F00_thumb_5F00_03B09337.png" width="893" height="160" /></a></p>  <p>When you test the runbook, remember that the build number has to be unique in all build definitions.&#160; Even a build is deleted, the record in the database will still have the build number and there is no way to change it.&#160; So don’t use the same build number in the testing as the one you would use in the production run.&#160; Have fun!</p>]]></content:encoded>
    </item>
    <item>
      <title>Run PowerShell scripts that interact with host</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/run-powershell-scripts-that-interact-with-host</link>
      <pubDate>Sun, 27 May 2012 15:08:46 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/05/27/run-powershell-scripts-that-interact-with-host/</guid>
      <description><![CDATA[If you have been using “Run .NET Script” for some time, you probably know that not all kinds of...]]></description>
      <content:encoded><![CDATA[<p>If you have been using “Run .NET Script” for some time, you probably know that not all kinds of PowerShell scripts will work with this activity.&#160; If a script tries to use “Write-Host” or similar to interact with the host, the execution will fail.&#160; For instance, try to run “[Guid]::NewGuid() | Write-Host” in Runbook Tester, you will see the following error:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/8270.image_2B30BFBE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/8270.image_5F00_2B30BFBE.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/6840.image_thumb_35EE1713.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/6840.image_5F00_thumb_5F00_35EE1713.png" width="532" height="59" /></a></p>  <p>Attach windbg to PolicyModule.exe and capture the exception, we can see:</p>  <p><font color="#8064a2" size="2" face="Consolas">(174.159c): CLR exception - code e0434f4d (first chance)     <br />Exception object: 04f274cc      <br /><font style="background-color: #ffff00">Exception type: System.Management.Automation.Host.HostException       <br />Message: Cannot invoke this function because the current host does not implement it.        <br /></font>InnerException: &lt;none&gt;      <br />StackTrace (generated):      <br />&lt;none&gt;      <br />StackTraceString: &lt;none&gt;      <br />HResult: 80131501      <br />First chance exceptions are reported before any exception handling.      <br />This exception may be expected and handled.      <br />eax=08abea90 ebx=e0434f4d ecx=00000001 edx=00000000 esi=08abeb18 edi=06d040c0      <br />eip=766bb9bc esp=08abea90 ebp=08abeae0 iopl=0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nv up ei pl nz ac pe nc      <br />cs=0023&#160; ss=002b&#160; ds=002b&#160; es=002b&#160; fs=0053&#160; gs=002b&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; efl=00000216      <br />KERNELBASE!RaiseException+0x58:      <br />766bb9bc c9&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; leave      <br />0:024&gt; !clrstack      <br />OS Thread Id: 0x159c (24)      <br />ESP&#160;&#160;&#160;&#160;&#160;&#160; EIP&#160;&#160;&#160;&#160; <br />08abeb68 766bb9bc [HelperMethodFrame: 08abeb68]       <br />08abec0c 5d460695 <font style="background-color: #ffff00">System.Management.Automation.Internal.Host.InternalHostRawUserInterface.ThrowNotInteractive()       <br />08abec20 5d4606f1 System.Management.Automation.Internal.Host.InternalHostRawUserInterface.get_ForegroundColor()        <br />08abec54 5cb29451 Microsoft.PowerShell.Commands.ConsoleColorCmdlet.get_ForegroundColor()        <br />08abec84 5cb47207 Microsoft.PowerShell.Commands.WriteHostCommand.PrintObject(System.Object)        <br /></font>08abecc0 5cb475f0 Microsoft.PowerShell.Commands.WriteHostCommand.ProcessRecord()      <br />08abecf0 5cfe2388 System.Management.Automation.Cmdlet.DoProcessRecord()      <br />08abecf8 5d0311a0 System.Management.Automation.CommandProcessor.ProcessRecord()      <br />08abed38 5d01cfe5 System.Management.Automation.CommandProcessorBase.DoExecute()      <br />08abed68 5d0284cd System.Management.Automation.Internal.PipelineProcessor.Inject(System.Object, Boolean)      <br />08abed84 5d023baf System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(System.Object, System.Collections.Hashtable, Boolean)      <br />08abedcc 5d02ac03 System.Management.Automation.PipelineNode.Execute(System.Array, System.Management.Automation.Internal.Pipe, System.Collections.ArrayList ByRef, System.Management.Automation.ExecutionContext)      <br />08abee18 5d02a884 System.Management.Automation.StatementListNode.ExecuteStatement(System.Management.Automation.ParseTreeNode, System.Array, System.Management.Automation.Internal.Pipe, System.Collections.ArrayList ByRef, System.Management.Automation.ExecutionContext)      <br />08abee64 5d02a79e System.Management.Automation.StatementListNode.Execute(System.Array, System.Management.Automation.Internal.Pipe, System.Collections.ArrayList ByRef, System.Management.Automation.ExecutionContext)      <br />08abeea8 5d02a6b1 System.Management.Automation.ParseTreeNode.Execute(System.Array, System.Management.Automation.Internal.Pipe, System.Management.Automation.ExecutionContext)      <br />08abeec4 5d02a4bf System.Management.Automation.ScriptCommandProcessor.ExecuteWithCatch(System.Management.Automation.ParseTreeNode, System.Array)      <br />08abef04 5d028a79 System.Management.Automation.ScriptCommandProcessor.RunClause(System.Management.Automation.ParseTreeNode, System.Object, System.Object)      <br />08abef50 5d02861c System.Management.Automation.ScriptCommandProcessor.Complete()      <br />08abef68 5d01d1fe System.Management.Automation.CommandProcessorBase.DoComplete()      <br />08abef9c 5d023c2f System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(System.Object, System.Collections.Hashtable, Boolean)      <br />08abefe4 5d023b12 System.Management.Automation.Internal.PipelineProcessor.SynchronousExecute(System.Array, System.Collections.Hashtable)      <br />08abeff8 5d01fe09 System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()      <br />08abf050 5d01f8c7 System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()      <br />08abf0a0 5ec57036 System.Threading.ThreadHelper.ThreadStart_Context(System.Object)      <br />08abf0ac 5ec604bf System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)      <br />08abf0c4 5ec56fb4 System.Threading.ThreadHelper.ThreadStart()      <br />08abf2ec 6fd11b4c [GCFrame: 08abf2ec] </font></p>  <p>In general, if we want to run a PowerShell script we will create a Runspace object, create a pipeline from the runspace and add scripts to it, and invoke it.&#160; When we create the Runspace object, there are multiple factory methods can be used (see <a href="https://technet.microsoft.com/en-us/library/system.management.automation.runspaces.runspacefactory_members(v=vs.85).aspx" target="_blank">RunspaceFactory Members on TechNet</a>).&#160; The activity uses a simple one thus the default host is used which has various limitations.&#160; If it was your own code, you would need to write a custom PSHost (see <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/system.management.automation.host.pshost(v=vs.85).aspx" target="_blank">PSHost Class</a>) and pass it to CreateRunspace method.&#160; By the way, it is a nontrivial work.&#160; However it is not, so you may look for two options:</p>  <ul>   <li>Revise the script so it contains no *-Host cmdlet anywhere.</li>    <li>Use a different activity.</li> </ul>  <p>If the script cannot be changed for some reason (e.g. has to use a cmdlet which interacts with host), we can try the second option.&#160; In fact, <a href="https://orchestrator.codeplex.com/wikipage?title=Integration%20Pack%20for%20Windows%20PowerShell%202&amp;referringTitle=Documentation" target="_blank">PowerShell integration pack</a> is designed to solve this issue.&#160; This IP has been changed a lot recently, the documentation does not reflect the latest state, I will write a few posts to explain the changes.</p>  <p>The most straightforward way to run 32-bit PowerShell script is to use “Quick Run Script” activity.&#160; Suppose we want to run “Get-Process” and capture the output, the input parameters will be:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/0247.image_1C8613D9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/0247.image_5F00_1C8613D9.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/0245.image_thumb_0E479AE9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/0245.image_5F00_thumb_5F00_0E479AE9.png" width="563" height="194" /></a></p>  <p>Note the output log file will not be overwritten after running the activity, new logs will be appended after the existing content.&#160; After running the output log file looks like:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/3487.image_74DF97AE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/3487.image_5F00_74DF97AE.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2313.image_thumb_3032FD6D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2313.image_5F00_thumb_5F00_3032FD6D.png" width="690" height="386" /></a></p>  <p>You can also set the input parameter to capture the logs that write to standard error.&#160; The output device is set to 132 columns in width, so each line in the output/error will be padded with some spaces, remember to make the Notepad window big enough otherwise it will seem a bit strange.</p>  <p>From the optional properties, you may see that this activity can also run scripts remotely via WinRM (same as Invoke-Command cmdlet):</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/1731.image_1AD54805.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/1731.image_5F00_1AD54805.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/5047.image_thumb_088C8143.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/5047.image_5F00_thumb_5F00_088C8143.png" width="145" height="150" /></a></p>  <p>The PowerShell IP can also run 64-bit PowerShell scripts locally or remotely in a native manner without running “winrm quickconfig”, I will write another post to explain that.</p>]]></content:encoded>
    </item>
    <item>
      <title>Workflow activities for invoking a Runbook from Team Build</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/workflow-activities-for-invoking-a-runbook-from-team-build</link>
      <pubDate>Fri, 25 May 2012 14:02:55 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/05/25/workflow-activities-for-invoking-a-runbook-from-team-build/</guid>
      <description><![CDATA[On a project there is a need to invoke a runbook for the following scenario:     Product source code...]]></description>
      <content:encoded><![CDATA[<p>On a project there is a need to invoke a runbook for the following scenario:</p>  <ol>   <li>Product source code is stored in TFS source repository. </li>    <li>Daily and gated build definitions are created in the team project. </li>    <li>When the team build is triggered, a Windows Workflow (defined in Build Process Template) will be started on the build agent. </li>    <li>After the workflow initializes workspace, gets source code, runs MSBuild successfully, the test will be started. </li>    <li>The workflow starts an Orchestrator runbook to perform the test asynchronously. </li>    <li>For gated build, the workflow will wait for the runbook to be completed in order to decide whether to commit the code changes or not.&#160; For daily build, the runbook takes cares of test case results importing and the rest. </li> </ol>  <p>In order to integrate with Team Build process smoothly, two workflow activities were written and shared at <a href="https://orchestrator.codeplex.com">https://orchestrator.codeplex.com</a>.&#160; Please go to the source code area to download the project:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2210.image_3219A4EE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2210.image_5F00_3219A4EE.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/4846.image_thumb_66BA0129.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/4846.image_5F00_thumb_5F00_66BA0129.png" width="320" height="296" /></a></p>  <p>Two activities are:</p>  <ul>   <li><strong>StartRunbook</strong>: invoke a runbook via web service. </li>    <li><strong>RunbookJobStatus</strong>: check the runbook job status and return values when it’s completed. </li> </ul>  <p>A simple workflow as a part of build process template (modified from DefaultTemplates.xaml) looks like:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2625.image_789694F6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2625.image_5F00_789694F6.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2318.image_thumb_7F499E79.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2318.image_5F00_thumb_5F00_7F499E79.png" width="571" height="535" /></a></p>  <p>The input parameters for <strong>StartRunbook</strong> are:</p>  <ul>   <li><strong>OrchestratorUrl</strong>: URL of the Orchestrator web service. </li>    <li><strong>RunbookPath</strong>: full path of the runbook to be invoked. </li>    <li><strong>BinariesDirectory</strong>: a network share where the product binaries being built can be accessed by the runbook. </li>    <li><strong>BuildConfiguration</strong>: e.g. Debug/Release/Checked/Retail, etc. </li>    <li><strong>CustomParameter</strong>: extra parameter passed to the runbook. </li> </ul>  <p>The output is the job ID.&#160; The input parameters for RunbookJobStatus are:</p>  <ul>   <li><strong>OrchestratorUrl</strong>: URL of the Orchestrator web service. </li>    <li><strong>JobId</strong> </li> </ul>  <p>The output parameters are:</p>  <ul>   <li><strong>TestOutcome</strong>: e.g. Passed/Failed/Inconclusive, etc. </li>    <li><strong>RunbookReturnData</strong>: other runbook return data as a dictionary.&#160; </li> </ul>  <p>The runbook to be invoked is expected to have the following parameters:</p>  <ul>   <li><strong>DropLocation</strong>: where the binaries are. </li>    <li><strong>BuildNumber</strong>: build number </li>    <li><strong>TeamProject</strong>: name of the team project </li>    <li><strong>BuildDefinition</strong>: name of the build definition </li>    <li><strong>ShelveSetName</strong>: name of the shelveset for gated build, or empty string. </li>    <li><strong>BuildReason</strong>: see <a href="https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.client.buildreason.aspx" target="_blank">MSDN documentation</a> </li>    <li><strong>BuildUri</strong>: the URI of the build detail object. </li>    <li><strong>RequestedFor</strong>: user name who requested the build, e.g. the user who runs “tf submit” for gated build. </li>    <li><strong>BuildConfiguration</strong>: e.g. Debug/Release/Checked/Retail, etc. </li>    <li><strong>CustomParameter</strong>: extra parameter passed to the runbook. </li> </ul>  <p>The runbook is expected to return at least “TestOutcome” as a string.&#160; If any of those parameter is not defined, the StartRunbook activity will not invoke the runbook.&#160; If the runbook needs any other details it can use “Get Build Details” activity in TFS IP to query.</p>  <p>If there is any issue, please let me know.&#160; Have fun!</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows Workflow Integration Pack is on CodePlex</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/windows-workflow-integration-pack-is-on-codeplex</link>
      <pubDate>Thu, 24 May 2012 23:36:26 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/05/24/windows-workflow-integration-pack-is-on-codeplex/</guid>
      <description><![CDATA[After getting approval, today I uploaded the source code for the Windows Workflow Integration Pack...]]></description>
      <content:encoded><![CDATA[<p>After getting approval, today I uploaded the source code for the Windows Workflow Integration Pack to <a title="https://orchestrator.codeplex.com/" href="https://orchestrator.codeplex.com/">https://orchestrator.codeplex.com/</a>.&#160; You can build the IP on your own development machine or directly download the OIP file from the source code repository:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7282.image_521AD074.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7282.image_5F00_521AD074.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/5557.image_thumb_38469A45.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/5557.image_5F00_thumb_5F00_38469A45.png" width="402" height="411" /></a></p>  <p>This IP is built on .NET 4 to suppose the Windows Workflow 4 with SQL persistence.&#160; Before installing it, you have to follow <a href="https://blogs.msdn.com/b/yao/archive/2012/05/22/enable-net-4-in-orchestrator-integration-toolkit.aspx" target="_blank">this instruction</a> to enable .NET 4 for OIT.&#160; Currently there are following activities:</p>  <ul>   <li><strong>Start Workflow</strong>: loads a workflow from XAML file or DLL and starts execution.&#160; You can set up to 10 input parameters (if 10 is not enough, please let me know) as string and 10 workflow extensions.&#160; Optionally you can specify a SQL database connection for persistence.&#160; Note that the activity returns immediately after the workflow is started.</li>    <li><strong>Terminate Workflow</strong>: a running workflow with given ID can be terminated.</li>    <li><strong>Get Workflow Status</strong>: checks if a workflow is running or closed or unloaded.&#160; If it is not completed, optionally you can wait for completion instead of pooling periodically.&#160; If the workflow is completed successfully, this activity will publish the return data of the workflow in Name/Value pairs.</li>    <li><strong>Unload Workflow</strong>: if you have specified a valid SQL database connection in Start Workflow, the state of the workflow will be persisted into the database when the workflow is idle.&#160; Using this activity, it will unload the workflow from memory.</li>    <li><strong>Resume Workflow</strong>: a unloaded workflow can be resumed.&#160; Either same or different machine will work, as long as the same workflow and same database connection are used.</li> </ul>  <p>Note that the IP uses <a href="https://msdn.microsoft.com/en-us/library/dd987846" target="_blank">System.Activities.WorkflowApplication</a> to host the workflow instance, so it is the same behavior as you read on MSDN documentation.&#160; Before using the database persistence, you will need to create a database, and runs the following two SQL scripts against it in order:</p>  <ul>   <li>%windir%\Microsoft.NET\Framework\v4.0.30319\SQL\en\SqlWorkflowInstanceStoreSchema.sql</li>    <li>%windir%\Microsoft.NET\Framework\v4.0.30319\SQL\en\SqlWorkflowInstanceStoreLogic.sql</li> </ul>  <p>For more information on the SQL instance store, please refer to <a title="https://msdn.microsoft.com/en-us/library/ee395773.aspx" href="https://msdn.microsoft.com/en-us/library/ee395773.aspx">https://msdn.microsoft.com/en-us/library/ee395773.aspx</a> and <a title="https://msdn.microsoft.com/en-us/library/dd489452(v=vs.100).aspx" href="https://msdn.microsoft.com/en-us/library/dd489452(v=vs.100).aspx">https://msdn.microsoft.com/en-us/library/dd489452(v=vs.100).aspx</a>.</p>  <p>Later my colleague will provide more details and demonstrate a few scenarios with this IP.&#160; I may also give some technical details.&#160; If you have any questions or feature request, please let me know.&#160; Thanks!</p>]]></content:encoded>
    </item>
    <item>
      <title>TFS Integration Pack is on CodePlex</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/tfs-integration-pack-is-on-codeplex</link>
      <pubDate>Wed, 23 May 2012 00:09:54 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/05/23/tfs-integration-pack-is-on-codeplex/</guid>
      <description><![CDATA[In my first post I mentioned that there was a TFS IP for Microsoft internal people.&#160; Later it...]]></description>
      <content:encoded><![CDATA[<p>In my first post I mentioned that there was a TFS IP for Microsoft internal people.&#160; Later it was released on CodePlex at <a href="https://orchestrator.codeplex.com/" target="_blank">https://orchestrator.codeplex.com/</a>.&#160; Please read the documentation at <a href="https://orchestrator.codeplex.com/wikipage?title=Integration%20Pack%20for%20Microsoft%20Team%20Foundation%20Server%202010&amp;referringTitle=Documentation" target="_blank">here</a> and <a href="https://orchestrator.codeplex.com/wikipage?title=TFS%20IP%201.4%20new%20features&amp;referringTitle=Documentation" target="_blank">list of new features in 1.4</a>.&#160; Currently there are following activities in the latest 1.5 version:</p>  <ul>   <li>Work Item Tracking</li>    <ul>     <li>Get Work Item</li>      <li>Set Work Item</li>      <li>New Work Item</li>      <li>Query Work Items</li>      <li>Monitor Work Items Query</li>   </ul>    <li>Version Control</li>    <ul>     <li>List Version Control Items</li>      <li>Download File</li>      <li>Update Workspace</li>      <li>Check in</li>      <li>Check out</li>      <li>Get Changeset</li>      <li>Get Shelveset</li>   </ul>    <li>Team Build</li>    <ul>     <li>Get Build Definitions</li>      <li>Get Build Details</li>      <li>Request Build</li>      <li>Set Build Details</li>      <li>Monitor Build</li>      <li>Create Manual Build</li>   </ul>    <li>Test Management</li>    <ul>     <li>Add Test Case Result</li>      <li>Create Test Run</li>      <li>Get Test Configurations</li>      <li>Get Test Plan</li>      <li>Get Test Runs</li>      <li>Get Test Suites</li>   </ul> </ul>  <p>I will write a few posts later to explain how to use the new activities.&#160; Note that there is no activity for Visual Studio Lab Management (VSLM), and I do not plan to add it.&#160; This is because VSLM client SDK or API is not publically available and will not be supported (suppose you get it via reflection) in 2010 release.&#160; The recommended approach for automating this part is to use the lab workflow activities (Windows workflow), i.e. create a workflow in Visual Studio IDE in XAML and invoke it.&#160; One can read <a href="https://msdn.microsoft.com/en-us/library/ff934561" target="_blank">Customizing Lab Management Workflow</a> to get more details on this.</p>  <p>Please let me know if you have any feedback on TFS IP, any bug to fix, or any new feature you want to have.&#160; I will evaluate and add appropriate ones as soon as I am free.&#160; Thanks!</p>]]></content:encoded>
    </item>
    <item>
      <title>Enable .NET 4 in Orchestrator Integration Toolkit</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/enable-net-4-in-orchestrator-integration-toolkit</link>
      <pubDate>Tue, 22 May 2012 23:49:30 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2012/05/22/enable-net-4-in-orchestrator-integration-toolkit/</guid>
      <description><![CDATA[WARNING: please note that this is a just workaround to use .NET 4 but it is NOT supported by the...]]></description>
      <content:encoded><![CDATA[<p><strong>WARNING</strong>: please note that this is a just workaround to use .NET 4 but it is NOT supported by the product group.&#160; I have been using it without any issues, but it does not mean this approach is well tested.</p>  <p>Currently the Orchestrator Integration Toolkit (OIT) in Orchestrator 2012 RTM only supports .NET 3.5 (which is CLR2), this means only assemblies in CLR2 will be packaged into OIP file and get deployed and be runnable in the system.&#160; If you create a Class Library project in Visual Studio using .NET 4 for developing an integration pack, it will not work.&#160; This is because CLR2 does not support CLR4 assemblies.&#160; However, CLR4 supports <a href="https://msdn.microsoft.com/en-us/magazine/ee819091.aspx" target="_blank">In-Process Side-by-Side</a>, so if the policy module process loads CLR4 first then both CLR4 and CLR2 assemblies will work.</p>  <p>Take a deeper look at the architecture of the server extension, In fact policy module is written in native code and it only understands COM interface.&#160; During installation, a managed class in Microsoft.SystemCenter.Orchestrator.Integration.Framework.dll is registered as a 32-bit COM server using regasm.exe.&#160; That is the entry point from native code to managed code.&#160; By changing the runtime version of this COM server, we can specify which .NET to load.</p>  <p>Before doing the following changes, make sure .NET 4 has been installed.&#160; Otherwise nothing will work.</p>  <p>So the first step is to change the runtime version of aforementioned COM server in the registry.&#160; Run regedit.exe, search “Microsoft.SystemCenter.Orchestrator.Integration.Framework” under HKCR\Wow6432Node\CLSID or go directly to HKCR\Wow6432Node\CLSID\{A2FE38AE-8F0D-4bad-AC0D-C1DC1EFD392A}\InprocServer32, change “RuntimeVersion” from “v2.0.50727” to “v4.0.30319”.&#160; Also change the same key at HKCR\Wow6432Node\CLSID\{A2FE38AE-8F0D-4bad-AC0D-C1DC1EFD392A}\InprocServer32\7.0.0.0.</p>  <p>With this change, integration packs written in .NET4 will be loaded.&#160; We also want to package OIP so IPWizard.exe has to be loaded with CLR4 otherwise it cannot load .NET 4 assemblies and cannot perform the reflection.&#160; This can be done by creating create IPWizard.exe.config at &quot;C:\Program Files (x86)\Microsoft System Center 2012\Orchestrator\Integration Toolkit\Bin&quot; with the following contents:</p>  <pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">configuration</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">startup</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">supportedRuntime</span> <span class="attr">version</span><span class="kwrd">=&quot;v4.0.30319&quot;</span> <span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">startup</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">configuration</span><span class="kwrd">&gt;</span></pre>


<p>Now everything is done.&#160; The system is ready to handle both existing integration packs in .NET 3.5 and new ones in .NET 4.&#160; I will be releasing one to try it out.&#160; Stay tuned.</p>]]></content:encoded>
    </item>
    <item>
      <title>Run .Net Script activity fails for simple PowerShell script, why?</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/run-net-script-activity-fails-for-simple-powershell-script-why</link>
      <pubDate>Mon, 20 Jun 2011 00:14:18 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2011/06/20/run-net-script-activity-fails-for-simple-powershell-script-why/</guid>
      <description><![CDATA[When the Run .Net Script activity fails, sometimes the error message is not very...]]></description>
      <content:encoded><![CDATA[<p>When the Run .Net Script activity fails, sometimes the error message is not very informational.&#160; Someone showed me the following exception (screenshot&#160; of simplified repro):</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/8551.image_7A7C0472.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/8551.image_5F00_7A7C0472.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/3771.image_thumb_74352DE4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/3771.image_5F00_thumb_5F00_74352DE4.png" width="620" height="380" /></a></p>  <p>The error summary does not say what “this function” is, what “the current host” means, and more importantly which part of the script triggers the unimplemented function so that we can workaround it.&#160; As a software engineer, I want to know whether it is the script’s fault or a bug in the activity, and how to fix it if it’s a bug.</p>  <p>Here we will see how to use windbg to get the stack trace when the exception is raised.</p>  <h1>Which process to debug?</h1>  <p>Engineers in the product group know that PolicyModule.exe hosts the workflow engine, and that is the starting point.&#160; However this may not seem obvious for outside people.&#160; Fortunately it is easy to figure it out using Process Explorer (<a title="https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" href="https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx</a>, run it from <a title="https://live.sysinternals.com/procexp.exe" href="https://live.sysinternals.com/procexp.exe">https://live.sysinternals.com/procexp.exe</a>).</p>  <p>In Options menu, click “Difference Highlight Duration”, change the value from 1 second to 5 so we can see it more clearly.&#160; Then start the Runbook Tester, procexp shows the newly created process PolicyModule.exe in green.&#160; After the job is finished, the color of the process turns to red which means the process is terminated.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/8154.image_2DB83DDC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/8154.image_5F00_2DB83DDC.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/5023.image_thumb_27053459.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/5023.image_5F00_thumb_5F00_27053459.png" width="595" height="48" /></a></p>  <p>The session ID (the last column in the screenshot) is 2 which is the current desktop session.&#160; This is good because windbg can automatically attach to it and show up on the desktop.&#160; If the runbook is picked up by the Action Server, PolicyModule.exe will be started in session 0.&#160; In that case, we use a slightly different way to debug, I will write it later.</p>  <h1>Setup “Image File Execution Options”</h1>  <p>By setting “Image File Execution Options”, the application will be automatically attached to the debugger as soon as it is launched.&#160; This method is typically used when something else is creating the process and manually starting it is not possible.&#160; For more information, refer to Junfeng’s blog at <a title="https://blogs.msdn.com/b/junfeng/archive/2004/04/28/121871.aspx" href="https://blogs.msdn.com/b/junfeng/archive/2004/04/28/121871.aspx">https://blogs.msdn.com/b/junfeng/archive/2004/04/28/121871.aspx</a> and <a href="https://blogs.msdn.com/b/greggm/archive/2005/02/21/377663.aspx" target="_blank">Inside 'Image File Execution Options' debugging</a>.&#160; It is really simple to use.&#160; Assume 32bit windbg is installed at C:\Debuggers32, run C:\Debuggers32\gflags.exe, click “Image File” tab, enter “PolicyModule.exe” (do not use full path), press TAB, select “Debugger” check box, and enter “C:\Debuggers\windbg.exe” (full path of the debugger), then click “OK” button to dismiss the dialog.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2605.image_3543AD49.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2605.image_5F00_3543AD49.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/4760.image_thumb_27DD9A43.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/4760.image_5F00_thumb_5F00_27DD9A43.png" width="536" height="530" /></a></p>  <h1>Start to Debug</h1>  <p>In Runbook Tester, click “Run” to start the runbook.&#160; Windbg will show up immediately.&#160; Now tell windbg to break on CLR exceptions and continue to run:</p>  <p><font color="#0000ff" face="Consolas">eax=00000000 ebx=00000000 ecx=60c50000 edx=0008e3b8 esi=fffffffe edi=77953b90      <br />eip=779d0f2b esp=0018fb0c ebp=0018fb38 iopl=0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nv up ei pl zr na pe nc       <br />cs=0023&#160; ss=002b&#160; ds=002b&#160; es=002b&#160; fs=0053&#160; gs=002b&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; efl=00000246       <br />ntdll!LdrVerifyImageMatchesChecksum+0x6ce:       <br />779d0f2b cc&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int&#160;&#160;&#160;&#160; 3       <br />0:000&gt; <strong><font style="background-color: #ffff00">sxe clr</font></strong>       <br />0:000&gt; <strong><font style="background-color: #ffff00">g</font></strong></font></p>  <p>After a while, the CLR exception is caught by windbg.&#160; Let’s see what it is:</p>  <p><font color="#0000ff" face="Consolas">(dfc.1250): CLR exception - code e0434f4d (first chance)      <br />First chance exceptions are reported before any exception handling.       <br />This exception may be expected and handled.       <br />*** ERROR: Symbol file could not be found.&#160; Defaulted to export symbols for C:\Windows\syswow64\KERNELBASE.dll -       <br />*** ERROR: Symbol file could not be found.&#160; Defaulted to export symbols for C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll -       <br />eax=089ff280 ebx=e0434f4d ecx=00000001 edx=00000000 esi=089ff308 edi=003835d8       <br />eip=7692b727 esp=089ff280 ebp=089ff2d0 iopl=0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nv up ei pl nz ac po nc       <br />cs=0023&#160; ss=002b&#160; ds=002b&#160; es=002b&#160; fs=0053&#160; gs=002b&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; efl=00000212       <br />KERNELBASE!RaiseException+0x58:       <br />7692b727 c9&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; leave       <br />0:030&gt; <strong><font style="background-color: #ffff00">.loadby sos mscorwks</font></strong>       <br />0:030&gt; <strong><font style="background-color: #ffff00">!sos.PrintException</font></strong>       <br />PDB symbol for mscorwks.dll not loaded       <br />Exception object: 04c14f5c       <br />Exception type: <font style="background-color: #ffff00">System.Management.Automation.Host.HostException        <br />Message: Cannot invoke this function because the current host does not implement it.         <br /></font>InnerException: &lt;none&gt;       <br />StackTrace (generated):       <br />&lt;none&gt;       <br />StackTraceString: &lt;none&gt;       <br />HResult: 80131501       <br />0:030&gt; <strong><font style="background-color: #ffff00">!sos.CLRStack</font></strong>       <br />OS Thread Id: 0x1250 (30)       <br />ESP&#160;&#160;&#160;&#160;&#160;&#160; EIP&#160;&#160;&#160;&#160; <br />089ff358 7692b727 [HelperMethodFrame: 089ff358]       <br />089ff3fc 6b6e175d <font style="background-color: #ffff00">System.Management.Automation.Internal.Host.InternalHostRawUserInterface.ThrowNotInteractive()        <br /></font>089ff410 6b6e1665 System.Management.Automation.Internal.Host.InternalHostRawUserInterface.get_ForegroundColor()       <br />089ff444 6d489451 Microsoft.PowerShell.Commands.ConsoleColorCmdlet.get_ForegroundColor()       <br />089ff474 6d4a7207 <font style="background-color: #ffff00">Microsoft.PowerShell.Commands.WriteHostCommand.PrintObject(System.Object)        <br /></font>089ff4b0 6d4a75f0 Microsoft.PowerShell.Commands.WriteHostCommand.ProcessRecord()       <br />089ff4e0 6b262388 System.Management.Automation.Cmdlet.DoProcessRecord()       <br />089ff4e8 6b2b11a0 System.Management.Automation.CommandProcessor.ProcessRecord()       <br />089ff528 6b29cfe5 System.Management.Automation.CommandProcessorBase.DoExecute()       <br />089ff558 6b2a84cd System.Management.Automation.Internal.PipelineProcessor.Inject(System.Object, Boolean)       <br />089ff574 6b2a3baf System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(System.Object, System.Collections.Hashtable, Boolean)       <br />089ff5bc 6b2aac03 System.Management.Automation.PipelineNode.Execute(System.Array, System.Management.Automation.Internal.Pipe, System.Collections.ArrayList ByRef, System.Management.Automation.ExecutionContext)       <br />089ff608 6b2aa884 System.Management.Automation.StatementListNode.ExecuteStatement(System.Management.Automation.ParseTreeNode, System.Array, System.Management.Automation.Internal.Pipe, System.Collections.ArrayList ByRef, System.Management.Automation.ExecutionContext)       <br />089ff654 6b2aa79e System.Management.Automation.StatementListNode.Execute(System.Array, System.Management.Automation.Internal.Pipe, System.Collections.ArrayList ByRef, System.Management.Automation.ExecutionContext)       <br />089ff698 6b2aa6b1 System.Management.Automation.ParseTreeNode.Execute(System.Array, System.Management.Automation.Internal.Pipe, System.Management.Automation.ExecutionContext)       <br />089ff6b4 6b2aa4bf System.Management.Automation.ScriptCommandProcessor.ExecuteWithCatch(System.Management.Automation.ParseTreeNode, System.Array)       <br />089ff6f4 6b2a8a79 System.Management.Automation.ScriptCommandProcessor.RunClause(System.Management.Automation.ParseTreeNode, System.Object, System.Object)       <br />089ff740 6b2a861c System.Management.Automation.ScriptCommandProcessor.Complete()       <br />089ff758 6b29d1fe System.Management.Automation.CommandProcessorBase.DoComplete()       <br />089ff78c 6b2a3c2f System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(System.Object, System.Collections.Hashtable, Boolean)       <br />089ff7d4 6b2a3b12 System.Management.Automation.Internal.PipelineProcessor.SynchronousExecute(System.Array, System.Collections.Hashtable)       <br />089ff7e8 6b29fe09 System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()       <br />089ff840 6b29f8c7 System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()       <br />089ff890 6c886df6 System.Threading.ThreadHelper.ThreadStart_Context(System.Object)       <br />089ff89c 6c89027f System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)       <br />089ff8b4 6c886d74 System.Threading.ThreadHelper.ThreadStart()       <br />089ffadc 6e561b4c [GCFrame: 089ffadc] </font></p>  <p>Obviously, the stack tells us that the exception is caused by <strong>WriteHost</strong> cmdlet because the <strong>InternalHostRawInterface</strong> throws an exception while encountering interactive operations. We could stop here, but we want to know what’s being written by <strong>WriteHost:</strong></p>  <p><font color="#0000ff" face="Consolas">0:030&gt; <strong><font style="background-color: #ffff00">!sos.CLRStack -a</font></strong>       <br />OS Thread Id: 0x1250 (30)       <br />ESP&#160;&#160;&#160;&#160;&#160;&#160; EIP&#160;&#160;&#160;&#160; <br />089ff358 7692b727 [HelperMethodFrame: 089ff358]       <br />089ff3fc 6b6e175d System.Management.Automation.Internal.Host.InternalHostRawUserInterface.ThrowNotInteractive()       <br />&#160;&#160;&#160; PARAMETERS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this = &lt;no data&gt;       <br />&#160;&#160;&#160; LOCALS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;</font></p>  <p><font color="#0000ff" face="Consolas">089ff410 6b6e1665 System.Management.Automation.Internal.Host.InternalHostRawUserInterface.get_ForegroundColor()      <br />&#160;&#160;&#160; PARAMETERS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this = 0x049b014c       <br />&#160;&#160;&#160; LOCALS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0x089ff414 = 0x00000000       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0x089ff410 = 0x00000000</font></p>  <p><font color="#0000ff" face="Consolas">089ff444 6d489451 Microsoft.PowerShell.Commands.ConsoleColorCmdlet.get_ForegroundColor()      <br />&#160;&#160;&#160; PARAMETERS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this = 0x04bdac30       <br />&#160;&#160;&#160; LOCALS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0x089ff448 = 0x00000000       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0x089ff444 = 0x00000000</font></p>  <p><font color="#0000ff" face="Consolas">089ff474 6d4a7207 <font style="background-color: #ffff00">Microsoft.PowerShell.Commands.WriteHostCommand.PrintObject</font>(System.Object)       <br />&#160;&#160;&#160; PARAMETERS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this = 0x04bdac30       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; o = &lt;no data&gt;       <br />&#160;&#160;&#160; LOCALS:       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;CLR reg&gt; = 0x04bf7d68       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0x089ff478 = 0x00000000       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;no data&gt;       <br />…</font></p>  <p><font color="#0000ff" face="Consolas">0:030&gt; <strong><font style="background-color: #ffff00">!sos.do 0x04bf7d68          <br /></font></strong>Name: System.String       <br />MethodTable: 6c8e0ae8       <br />EEClass: 6c69d65c       <br />Size: 20(0x14) bytes       <br />(C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)       <br /><font style="background-color: #ffff00">String: 3</font>       <br />Fields:       <br />&#160;&#160;&#160;&#160;&#160; MT&#160;&#160;&#160; Field&#160;&#160; Offset&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Type VT&#160;&#160;&#160;&#160; Attr&#160;&#160;&#160; Value Name       <br />6c8e2d34&#160; 4000096&#160;&#160;&#160;&#160;&#160;&#160;&#160; 4&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Int32&#160; 1 instance&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 m_arrayLength       <br />6c8e2d34&#160; 4000097&#160;&#160;&#160;&#160;&#160;&#160;&#160; 8&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Int32&#160; 1 instance&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 m_stringLength       <br />6c8e17c8&#160; 4000098&#160;&#160;&#160;&#160;&#160;&#160;&#160; c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Char&#160; 1 instance&#160;&#160;&#160;&#160;&#160;&#160; 33 m_firstChar       <br />6c8e0ae8&#160; 4000099&#160;&#160;&#160;&#160;&#160;&#160; 10&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.String&#160; 0&#160;&#160; shared&#160;&#160; static Empty       <br />&#160;&#160;&#160; &gt;&gt; Domain:Value&#160; 0033b8a8:04981198 &lt;&lt;       <br />6c8e1718&#160; 400009a&#160;&#160;&#160;&#160;&#160;&#160; 14&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Char[]&#160; 0&#160;&#160; shared&#160;&#160; static WhitespaceChars       <br />&#160;&#160;&#160; &gt;&gt; Domain:Value&#160; 0033b8a8:0498185c &lt;&lt;</font></p>  <p>In this repro the script being executed is “1 + 2 | Write-Host”, so it is correct that the string passed to <strong>WriteHost</strong> is “3”.</p>  <h1>Workaround</h1>  <p>Because the internal host in “Run .Net Script” does not support any host interaction, the workaround is to avoid all such cmdlets, for instance Write-Host, Read-Host, etc.</p>  <h1>How to fix it?</h1>  <p>Modifying the script which potentially calls into other scripts to workaround this issue may not be straightforward.&#160; How to fix it from Orchestrator’s side?</p>  <p>Typically the first step of executing PowerShell scripts is to create a Runspace using <a href="https://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.runspacefactory.createrunspace(v=VS.85).aspx" target="_blank">RunspaceFactory.CreateRunspace</a> method (in name space <a href="https://msdn.microsoft.com/en-us/library/ms569896(v=VS.85).aspx" target="_blank">System.Management.Automation.Runspaces</a>).&#160; Creating local runspace is often done by the method <a href="https://msdn.microsoft.com/en-us/library/ms569311(v=VS.85).aspx" target="_blank">CreateRunspace()</a> with the default host and configuration.&#160; Here the default host refers to System.Management.Automation.Internal.Host.InternalHost, and the property <strong>UI</strong> is InternalHostUserInterface instance.&#160; Implementations of PSHostInterface methods delegate to <strong>externalUI</strong> of same interface, which is null for default host.&#160; In this case, when host interaction methods are called, HostException is thrown with the message which we see in windbg.</p>  <p>In order to handle host interactions properly and solve this issue, a custom host (interface PSHost) and host interface (interface PSHostUserInterface) need to be implemented.&#160; When the runspace is created, this custom host will be passed to CreateRunspace method.&#160; In other words, the activity should use the methods with PSHost argument in the overload list of <a href="https://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.runspacefactory.createrunspace(v=VS.85).aspx" target="_blank">RunspaceFactory.CreateRunspace</a> method.</p>  <p>The above analysis can be verified by checking the assembly containing Run .Net Script activity.&#160; From the list of DLL being loaded in windbg, one can see that the code is in RunScriptDomain.dll.&#160; Since it’s managed code, we can get the IL code for RunScriptDomain.PowerShellRunner.run() using ildasm (run from Visual Studio Command Prompt):</p>  <p><font color="#0000ff" face="Consolas">.method public hidebysig newslot virtual final      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; instance void&#160; run() cil managed      <br />{      <br />&#160; // Code size&#160;&#160;&#160;&#160;&#160;&#160; 60 (0x3c)      <br />&#160; .maxstack&#160; 2      <br />&#160; .locals init (class [System.Management.Automation]System.Management.Automation.Runspaces.Runspace V_0,      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; class [System.Management.Automation]System.Management.Automation.Runspaces.Pipeline V_1)      <br />&#160; IL_0000:&#160; call&#160;&#160;&#160;&#160;&#160;&#160; class [System.Management.Automation]System.Management.Automation.Runspaces.Runspace [System.Management.Automation]<font style="background-color: #ffff00">System.Management.Automation.Runspaces.RunspaceFactory::CreateRunspace()</font>      <br />&#160; IL_0005:&#160; stloc.0      <br />&#160; IL_0006:&#160; ldloc.0      <br />&#160; IL_0007:&#160; callvirt&#160;&#160; instance void [System.Management.Automation]System.Management.Automation.Runspaces.Runspace::Open()      <br />&#160; IL_000c:&#160; ldloc.0      <br />&#160; IL_000d:&#160; callvirt&#160;&#160; instance class [System.Management.Automation]System.Management.Automation.Runspaces.Pipeline [System.Management.Automation]System.Management.Automation.Runspaces.Runspace::CreatePipeline()      <br />&#160; IL_0012:&#160; stloc.1      <br />&#160; IL_0013:&#160; ldloc.1      <br />&#160; IL_0014:&#160; callvirt&#160;&#160; instance class [System.Management.Automation]System.Management.Automation.Runspaces.CommandCollection [System.Management.Automation]System.Management.Automation.Runspaces.Pipeline::get_Commands()      <br />&#160; IL_0019:&#160; ldarg.0      <br />&#160; IL_001a:&#160; ldfld&#160;&#160;&#160;&#160;&#160; class RunScriptDomain.Script RunScriptDomain.PowerShellRunner::_script      <br />&#160; IL_001f:&#160; callvirt&#160;&#160; instance string RunScriptDomain.Script::get_Contents()      <br />&#160; IL_0024:&#160; callvirt&#160;&#160; instance void [System.Management.Automation]System.Management.Automation.Runspaces.CommandCollection::AddScript(string)      <br />&#160; IL_0029:&#160; ldarg.0      <br />&#160; IL_002a:&#160; ldloc.1      <br />&#160; IL_002b:&#160; callvirt&#160;&#160; instance class [mscorlib]System.Collections.ObjectModel.Collection`1&lt;class [System.Management.Automation]System.Management.Automation.PSObject&gt; [System.Management.Automation]System.Management.Automation.Runspaces.Pipeline::Invoke()      <br />&#160; IL_0030:&#160; stfld&#160;&#160;&#160;&#160;&#160; class [mscorlib]System.Collections.ObjectModel.Collection`1&lt;class [System.Management.Automation]System.Management.Automation.PSObject&gt; RunScriptDomain.PowerShellRunner::resultOfRunningCmd      <br />&#160; IL_0035:&#160; ldloc.0      <br />&#160; IL_0036:&#160; callvirt&#160;&#160; instance void [System.Management.Automation]System.Management.Automation.Runspaces.Runspace::Close()      <br />&#160; IL_003b:&#160; ret      <br />} // end of method PowerShellRunner::run</font>    <br /></p>  <p>By the way, if IL code looks unfamiliar to you, take a look at <a href="https://reflector.red-gate.com/download.aspx?TreatAsUpdate=1" target="_blank">.NET Reflector</a> or open source <a href="https://wiki.sharpdevelop.net/ILSpy.ashx" target="_blank">ILSpy</a>.</p>  <p>If you wonder whether there is a PowerShell integration pack with a richer set of features so no workaround is needed, the answer is yes – a prototype is available, 32-bit and 64-bit runspace without WinRM, persistence and pooling of runspace across process boundary, remoting using WinRM, impersonation are all working.&#160; We are working hard to deliver the best customer experience.</p>]]></content:encoded>
    </item>
    <item>
      <title>QIK Wizard throws an exception, what to do?</title>
      <link>https://docs.microsoft.com/archive/blogs/yao/qik-wizard-throws-an-exception-what-to-do</link>
      <pubDate>Thu, 16 Jun 2011 12:26:28 GMT</pubDate>
      <dc:creator><![CDATA[Zhenhua Yao]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/yao/2011/06/16/qik-wizard-throws-an-exception-what-to-do/</guid>
      <description><![CDATA[Being excited by the elegance of .NET based Integration Pack architecture and simplicity of writing...]]></description>
      <content:encoded><![CDATA[<p>Being excited by the elegance of .NET based Integration Pack architecture and simplicity of writing such an IP, today my colleague decided to write his own “Hello World”.&#160; It didn’t take too long to get a DLL, and the next step is to package it to an OIP file.&#160; Then he found that QIK Wizard threw the following exception:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/1616.image_5701FA9F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/1616.image_5F00_5701FA9F.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7510.image_thumb_61BF51F4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7510.image_5F00_thumb_5F00_61BF51F4.png" width="553" height="383" /></a></p>  <p>Obviously the error message wasn’t helpful because it didn’t say what the exception really was, and how to resolve it.&#160; In this case, windbg is our friend.&#160; With SOS extension, windbg can tell us exactly what is happening and where the problem is.</p>  <h1>Install windbg</h1>  <p>For folks inside Microsoft, the latest internal version of windbg can be installed from the network share (contact me for more information).&#160; For external people, you may need to install Windows SDK to get windbg at <a title="https://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx" href="https://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx">https://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx</a>.&#160; Some time ago, there was a separate download package for windbg.&#160; Maybe someone can try <a title="https://msdn.microsoft.com/en-us/windows/hardware/gg463016" href="https://msdn.microsoft.com/en-us/windows/hardware/gg463016">https://msdn.microsoft.com/en-us/windows/hardware/gg463016</a> and see if it works.</p>  <h1>Attach QIK Wizard process to windbg</h1>  <p>Run C:\Debuggers32\windbg.exe and press F6 to attach a process:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/7103.image_63CC2AF0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/7103.image_5F00_63CC2AF0.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/8270.image_thumb_7C5BC840.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/8270.image_5F00_thumb_5F00_7C5BC840.png" width="387" height="527" /></a></p>  <p>Select QIKWizard.exe and click OK button.&#160; Now the process breaks into the debugger.&#160; QIK Wizard is a managed process and that exception is a CLR exception, so we want to catch the CLR exception:</p>  <p><font color="#0000ff" face="Consolas">0:008&gt; <font style="background-color: #ffff00">sxe clr</font></font></p>  <p>Then press F5 to resume the process.&#160; Reload the same DLL, this time the exception is caught by windbg:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/5025.image_3F0AEDAC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/5025.image_5F00_3F0AEDAC.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/46/06/metablogapi/2308.image_thumb_0BCEB443.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-46-06-metablogapi/2308.image_5F00_thumb_5F00_0BCEB443.png" width="644" height="347" /></a></p>  <p>Note the message in the command window also shows which DLL’s have been loaded.&#160; In order to check the CLR exception, we need to load SOS extension:</p>  <p><font color="#0000ff" face="Consolas">0:000&gt; <font style="background-color: #ffff00">.loadby sos mscorwks</font></font></p>  <p>Then print the current CLR exception and managed stack:</p>  <p><font color="#0000ff" face="Consolas">0:000&gt; <font style="background-color: #ffff00">!sos.PrintException</font>      <br />Exception object: 02856d1c      <br />Exception type: System.BadImageFormatException      <br />Message: Could not load file or assembly 'file:///C:\Users\zhyao\Desktop\SampleIpP.dll' or one of its dependencies. <font style="background-color: #ffff00">This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.</font>      <br />InnerException: &lt;none&gt;      <br />StackTrace (generated):      <br />&lt;none&gt;      <br />StackTraceString: &lt;none&gt;      <br />HResult: 8013101b      <br />0:000&gt; <font style="background-color: #ffff00">!sos.CLRStack       <br /></font>OS Thread Id: 0x1378 (0)      <br />ESP&#160;&#160;&#160;&#160;&#160;&#160; EIP&#160;&#160;&#160;&#160; <br />003cdb90 7492b727 [HelperMethodFrame_PROTECTOBJ: 003cdb90] System.Reflection.Assembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.Assembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean)      <br />003cdc28 5e5e123c System.Reflection.Assembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.Assembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean)      <br />003cdc50 5e5dfc50 System.Reflection.Assembly.InternalLoad(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean)      <br />003cdc78 5e55a6a4 System.Reflection.Assembly.InternalLoadFrom(System.String, System.Security.Policy.Evidence, Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm, Boolean, System.Threading.StackCrawlMark ByRef)      <br />003cdc98 5e55a641 System.Reflection.Assembly.LoadFrom(System.String)      <br />003cdca4 0043d761 Opalis.QuickIntegrationKit.Framework.Core.DomainManager.LoadAssembly(System.String)      <br />003cdcd4 0043d719 Opalis.QuickIntegrationKit.Framework.Core.DomainManager.FindObjectTypes(System.String)      <br />003cdcdc 0043d65e Opalis.QuickIntegrationKit.Framework.RequestBroker.GetObjectTypesFrom(System.String)      <br />003cdf10 5f8d6678 [GCFrame: 003cdf10]       <br />003ce06c 5f8d6678 [ComMethodFrame: 003ce06c]       <br />003ce198 5f8d6678 [NDirectMethodFrameStandalone: 003ce198] Opalis.QIK.Wizard.Domain.Utility.StandardLibraryExplorer.getNumServices(System.String)      <br />003ce1a8 0043cac5 Opalis.QIK.Wizard.Domain.Utility.StandardLibraryExplorer.DoGetServices(System.String)      <br />003ce1ec 0043c9d0 Opalis.QIK.Wizard.Domain.Utility.LibraryExplorer.GetServices(System.String)      <br />003ce1f4 0043d50e Opalis.QIK.Wizard.Presentation.ObjectPresenter.GetServices(Opalis.QIK.Wizard.Views.IObjectView, System.String)      <br />003ce22c 0043d461 Opalis.QIK.Wizard.Presentation.ObjectPresenter.LibrarySelected(System.Object, Opalis.QIK.Wizard.Views.FileEventArgs)      <br />003ce244 0043d3ed Opalis.QIK.Wizard.OpenFileView.ShowView()      <br />003ce258 0043d238 Opalis.QIK.Wizard.Presentation.ObjectPresenter.SelectLibrary(System.Object, System.EventArgs)      <br />003ce270 0043d1b6 Opalis.QIK.Wizard.ObjectTypeForm.BrowseLibraryButton_Click(System.Object, System.EventArgs)      <br />003ce280 5d064170 System.Windows.Forms.Control.OnClick(System.EventArgs)      <br />003ce298 5d05f55a System.Windows.Forms.Button.OnClick(System.EventArgs)      <br />003ce2a8 5d5f6f24 System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs)      <br />003ce2c4 5d5c7733 System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)      <br />003ce350 5d8fa152 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)      <br />003ce354 5d8f8921 [InlinedCallFrame: 003ce354]       <br />003ce3ec 5d0925b0 System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message ByRef)      <br />003ce3f8 5d0986a0 System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)      <br />003ce400 5d098621 System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)      <br />003ce414 5d0984fa System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)      <br />003ce5b8 0014113c [NDirectMethodFrameStandalone: 003ce5b8] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)      <br />003ce5c8 5d0a8cee System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32)      <br />003ce664 5d0a8957 System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)      <br />003ce6b8 5d0a87a1 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)      <br />003ce6e8 5d5bde2b System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)      <br />003ce6fc 5d5f2608 System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)      <br />003ce788 5d5f281f System.Windows.Forms.Form.ShowDialog()      <br />003ce78c 0043ce25 Opalis.QIK.Wizard.ObjectTypeForm.ShowView()      <br />003ce790 0043b07f Opalis.QIK.Wizard.Presentation.ObjectsPresenter.AddObject(System.Object, System.EventArgs)      <br />003ce7ac 0043afcd Opalis.QIK.Wizard.ObjectTypesStep.FireAddObject()      <br />003ce7b8 0043af8d Opalis.QIK.Wizard.ObjectTypesStep.AddButton_Click(System.Object, System.EventArgs)      <br />003ce7c0 5d064170 System.Windows.Forms.Control.OnClick(System.EventArgs)      <br />003ce7d8 5d05f55a System.Windows.Forms.Button.OnClick(System.EventArgs)      <br />003ce7e8 5d5f6f24 System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs)      <br />003ce804 5d5c7733 System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)      <br />003ce890 5d8fa152 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)      <br />003ce894 5d8f8921 [InlinedCallFrame: 003ce894]       <br />003ce92c 5d0925b0 System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message ByRef)      <br />003ce938 5d0986a0 System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)      <br />003ce940 5d098621 System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)      <br />003ce954 5d0984fa System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)      <br />003ceaf8 0014113c [NDirectMethodFrameStandalone: 003ceaf8] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)      <br />003ceb08 5d0a8cee System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32)      <br />003ceba4 5d0a8957 System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)      <br />003cebf8 5d0a87a1 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)      <br />003cec28 5d065911 System.Windows.Forms.Application.Run(System.Windows.Forms.Form)      <br />003cec3c 00430093 Opalis.QIK.Wizard.QuickIntegrationWizard.Main()      <br />003cee64 5f7b1b4c [GCFrame: 003cee64] </font>    <br /></p>  <p>From the exception message, it is clear that the CLR version of the DLL being loaded is newer than the CLR version of QIKWizard.&#160; Since QIKWizard uses .NET 3.5 which is CLR2, it means the DLL is actually built with CLR4.&#160; After changing the .NET framework version, the problem is solved.</p>  <p>Note that this debugging process does not need any symbols or Opalis source code.&#160; We do not even need to access public Microsoft symbol server.</p>  <p>Windbg with SOS extension can do many useful things.&#160; For more information on SOS, read MSDN documentation at <a title="https://msdn.microsoft.com/en-us/library/bb190764.aspx" href="https://msdn.microsoft.com/en-us/library/bb190764.aspx">https://msdn.microsoft.com/en-us/library/bb190764.aspx</a>.&#160; Later I will show you more simple tricks to troubleshoot Opalis issues.</p>]]></content:encoded>
    </item>
  </channel>
</rss>