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

<channel>
	<title>Michael Sync</title>
	<atom:link href="http://michaelsync.net/feed" rel="self" type="application/rss+xml" />
	<link>http://michaelsync.net</link>
	<description>Sharing knowledge</description>
	<lastBuildDate>Fri, 27 Nov 2015 04:55:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.6.11</generator>
	<item>
		<title>Unit Test parallel execution of static classes or ServiceLocator</title>
		<link>http://michaelsync.net/2015/10/01/unit-test-parallel-execution-of-static-classes-or-servicelocator</link>
		<comments>http://michaelsync.net/2015/10/01/unit-test-parallel-execution-of-static-classes-or-servicelocator#comments</comments>
		<pubDate>Fri, 02 Oct 2015 06:30:04 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Tests]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2933</guid>
		<description><![CDATA[Please note that I am NOT promoting an anti-pattern or code smell here. I know using the service locator or static classes that hold the state or cause the side-effect are not in everyone&#8217;s favor but let&#8217;s face it. Life is not perfect. What if you happen to be in a decade old legacy project [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Please note that I am NOT promoting an anti-pattern or code smell here. I know using the service locator or static classes that hold the state or cause the side-effect are not in everyone&#8217;s favor but let&#8217;s face it. Life is not perfect. What if you happen to be in a decade old legacy project that heavily depends on static classes or service locator pattern? But it shouldn&#8217;t stop you from adding the unit tests if you want.</p>
<p>Source Code for Test Project: <a href="https://github.com/michaelsync/Michael-Sync-s-blog-sample/tree/master/XunitTestsParallel">https://github.com/michaelsync/Michael-Sync-s-blog-sample/tree/master/XunitTestsParallel</a></p>
<h2>Mocking Static Classes</h2>
<p>The problem with the static class is that you can&#8217;t mock them unless your mocking library supports it. Here is the list of mock libraries (both free and commercial) that supports the static class mocking in .NET world.</p>
<ul>
<li><a href="https://msdn.microsoft.com/en-us/library/hh549175.aspx#shims" target="_blank">Microsoft Fakes (shim)</a></li>
<li><a href="http://research.microsoft.com/en-us/projects/pex/" target="_blank">Moles</a></li>
<li><a href="http://www.typemock.com/typemock-isolator-product3/" target="_blank">TypeMock</a></li>
<li><a href="http://www.telerik.com/products/mocking.aspx" target="_blank">JustMock</a>&nbsp;(not JustMock Lite)</li>
</ul>
<p>Let&#8217;s say we are using Microsoft Fakes. You can mock the DateTime.Now as below.</p>
<pre class="brush: plain; title: ; notranslate">
// Shims can be used only in a ShimsContext:
            using (ShimsContext.Create())
            {
              // Arrange:
                // Shim DateTime.Now to return a fixed date:
                System.Fakes.ShimDateTime.NowGet = 
                () =&gt;
                { return new DateTime(fixedYear, 1, 1); };

                // Instantiate the component under test:
                var componentUnderTest = new MyComponent();

              // Act:
                int year = componentUnderTest.GetTheCurrentYear();

              // Assert: 
                // This will always be true if the component is working:
                Assert.AreEqual(fixedYear, year);
            }
</pre>
<p>It&#8217;s pretty easy, huh? What about the <a href="https://commonservicelocator.codeplex.com" target="_blank">service locator</a>?</p>
<h2>Mocking Service Locator</h2>
<p>Mocking the service locator is very easy as well since it allows us to set the mock locator using
<pre class="brush: plain; title: ; notranslate">ServiceLocator.SetLocatorProvider()</pre>
<p> method.</p>
<p>The example below shows how to mock the service locator using Moq in xunit test.</p>
<pre class="brush: plain; title: ; notranslate">

public class TestClass1 {

        public TestClass1() {
            var mock = new Mock&lt;IDataStore&gt;();
            mock.Setup(m =&gt; m.GetData())
                .Returns(1); /* Returns 1 from TestClass1 */

            var mockServiceLocator = new Mock&lt;IServiceLocator&gt;();
            mockServiceLocator.Setup(ms =&gt; ms.GetInstance&lt;IDataStore&gt;())
                .Returns(mock.Object);

            ServiceLocator.SetLocatorProvider(() =&gt; mockServiceLocator.Object);
        }

        [Fact]
        private void TestClass1TestMethod1() {
            var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
            Assert.Equal&lt;int&gt;(1, data);
        }

        [Fact]
        private void TestClass1TestMethod2() {
            var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
            Assert.Equal&lt;int&gt;(1, data);
        }
}

</pre>
<p>So far so good. What is the problem?</p>
<h2>Test Parallelization</h2>
<p>Some test frameworks let you run the tests in parallel. For example, xunit 2.0 which is released <a href="https://xunit.github.io/release-notes/2015-03-16.html" target="_blank">early this year (March 16, 2015)</a> has a new feature that let the tests from different classes run in parallel by default. (You can read about it in &#8220;Parallelism&#8221; in the release note or here &#8220;<a href="https://xunit.github.io/docs/running-tests-in-parallel.html" target="_blank">Running Tests in Parallel</a>&#8221; ). xUnit 2.0 uses the concepts called &#8220;Test Collection&#8221; to decide which tests can run against each other in parallel. Each test class is a unique test collection and
<pre class="brush: plain; title: ; notranslate">ParallelizeTestCollections</pre>
<p> property is set to true by default.</p>
<p>So, the tests that has the dependency on server locator or static class will be failed randomly with test parallelization but the test will work fine when you run it individually. Because what you setup in one test will be overridden the setup from different test class so the assertion will be failed when the overrides happens.</p>
<p>I have TestClass1 in my previous example above. I will add another class called TestClass2 to show you te random test failture.</p>
<pre class="brush: plain; title: ; notranslate"> 
public class TestClass2 {
        public TestClass2() {
            var mock = new Mock&lt;IDataStore&gt;();
            mock.Setup(m =&gt; m.GetData())
                .Returns(2); /* Returns 2 here */

            var mockServiceLocator = new Mock&lt;IServiceLocator&gt;();
            mockServiceLocator.Setup(ms =&gt; ms.GetInstance&lt;IDataStore&gt;())
                .Returns(mock.Object);

            ServiceLocator.SetLocatorProvider(() =&gt; mockServiceLocator.Object);
        }

        [Fact]
        private void TestClass2TestMethod1() {
            var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
            Assert.Equal&lt;int&gt;(2, data);
        }

        [Fact]
        private void TestClass2TestMethod2() {
            var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
            Assert.Equal&lt;int&gt;(2, data);
        }
}

</pre>
<p>Try running all tests a few times after adding the TestClass2. You will see that at least one test out of four tests will be failed randomly. It is because the locator is a static class and what we setup (let&#8217;s say we return 1.) in TestClass1 will be overridden by the setup from TestClass2 so the assertion will be failed.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/Random-Test-Failed.png"><img class="alignnone size-full wp-image-2936" src="http://images.michaelsync.net/images/2015/09/Random-Test-Failed.png" alt="Random Test Failed" width="621" height="200" srcset="http://michaelsync.net/wp-content/uploads/2015/09/Random-Test-Failed.png 621w, http://michaelsync.net/wp-content/uploads/2015/09/Random-Test-Failed-300x97.png 300w" sizes="(max-width: 621px) 100vw, 621px" /></a></p>
<p>How do we fix that?</p>
<p>Initially, I looked at Microsoft Fakes which is shipped with Visual Studio and is also the <a href="http://research.microsoft.com/en-us/projects/moles/">next generation of Moles</a>. According to the concurrency section of <a href="https://msdn.microsoft.com/en-us/library/hh549176.aspx">this document</a>, it doesn&#8217;t have thread affinity so no go for me.</p>
<blockquote><p>
Shim types apply to all threads in the AppDomain and don’t have thread affinity. This is an important fact if you plan to use a test runner that support concurrency: tests involving shim types cannot run concurrently. This property is not enfored by the Fakes runtime.</p></blockquote>
<p>Then, I look at Telerik&#8217;s JuckMock. The paid version of JuckMock supports what they called &#8220;elevated-mocking&#8221; that allows you to mock the static class. (Note: The free version &#8220;JuckMock Lite&#8221; doesn&#8217;t support the elevated-mocking. )</p>
<p>So, I refactored my test code as below.</p>
<pre class="brush: plain; title: ; notranslate">

public class TestClass1 {
    private readonly Mock&lt;IServiceLocator&gt; mockServiceLocator;

    public TestClass1() {
        var mock = new Mock&lt;IDataStore&gt;();
        mock.Setup(m =&gt; m.GetData())
            .Returns(1);

        mockServiceLocator = new Mock&lt;IServiceLocator&gt;();
        mockServiceLocator.Setup(ms =&gt; ms.GetInstance&lt;IDataStore&gt;())
            .Returns(mock.Object);
    }


    [Fact]
    private void TestClass1TestMethod1() {
        Telerik.JustMock.Mock.Arrange&lt;IServiceLocator&gt;(() =&gt; ServiceLocator.Current)
            .Returns(mockServiceLocator.Object);

        var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
        Assert.Equal&lt;int&gt;(1, data);
    }

    [Fact]
    private void TestClass1TestMethod2() {
        Telerik.JustMock.Mock.Arrange&lt;IServiceLocator&gt;(() =&gt; ServiceLocator.Current)
                        .Returns(mockServiceLocator.Object);

        var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
        Assert.Equal&lt;int&gt;(1, data);
    }
}

public class TestClass2 {
    private readonly Mock&lt;IServiceLocator&gt; mockServiceLocator;

    public TestClass2() {
        var mock = new Mock&lt;IDataStore&gt;();
        mock.Setup(m =&gt; m.GetData())
            .Returns(2);

        mockServiceLocator = new Mock&lt;IServiceLocator&gt;();
        mockServiceLocator.Setup(ms =&gt; ms.GetInstance&lt;IDataStore&gt;())
            .Returns(mock.Object);
    }

    [Fact]
    private void TestClass2TestMethod1() {
        Telerik.JustMock.Mock.Arrange&lt;IServiceLocator&gt;(() =&gt; ServiceLocator.Current)
            .Returns(mockServiceLocator.Object);

        var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
        Assert.Equal&lt;int&gt;(2, data);
    }

    [Fact]
    private void TestClass2TestMethod2() {
        Telerik.JustMock.Mock.Arrange&lt;IServiceLocator&gt;(() =&gt; ServiceLocator.Current)
            .Returns(mockServiceLocator.Object);

        var data = ServiceLocator.Current.GetInstance&lt;IDataStore&gt;().GetData();
        Assert.Equal&lt;int&gt;(2, data);
    }
}

</pre>
<p><strong>Edited: </strong> I can&#8217;t move Mock.Arrange() to the constructor because I think JustMock has a thread affinity and xunit might use the different thread to call the constructor and test method. That&#8217;s why I repeat the code in every test method. <strong>End Edited.</strong></p>
<p>Before you run the test, there is a little small thing that you need to do. You need to enable the profiler in Telerik menu.</p>
<p><a href="http://images.michaelsync.net/images/2015/10/Enable-Profiler.png"><img src="http://images.michaelsync.net/images/2015/10/Enable-Profiler.png" alt="Enable Profiler" width="381" height="130" class="alignnone size-full wp-image-2962" srcset="http://michaelsync.net/wp-content/uploads/2015/10/Enable-Profiler.png 381w, http://michaelsync.net/wp-content/uploads/2015/10/Enable-Profiler-300x102.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></a></p>
<p>The reason is that JustMock is using the <a href="https://msdn.microsoft.com/en-us/library/ms404386(v=vs.110).aspx">profiling API</a> to enable the elevated mocking. I heard that TypeMock is using the same thing as well. Please read <a href="http://mattwarren.org/tag/net-profiling/">this post</a> if you want to know more about it.</p>
<p>Now, you can run all tests without any failure.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/All-Tests-passed.png"><img src="http://images.michaelsync.net/images/2015/09/All-Tests-passed.png" alt="All Tests passed" width="392" height="172" class="alignnone size-full wp-image-2941" srcset="http://michaelsync.net/wp-content/uploads/2015/09/All-Tests-passed.png 392w, http://michaelsync.net/wp-content/uploads/2015/09/All-Tests-passed-300x132.png 300w" sizes="(max-width: 392px) 100vw, 392px" /></a></p>
<p>You can download the sample test project here &#8220;<a href="https://github.com/michaelsync/Michael-Sync-s-blog-sample/tree/master/XunitTestsParallel">https://github.com/michaelsync/Michael-Sync-s-blog-sample/tree/master/XunitTestsParallel</a>&#8220;.</p>
<p>That is. Yes. I am not encouraging you to use this feature. If you have the capacity to remove the service locator or static classes from your project then you should probably do that. Otherwise, using the elevated mocking is one way of solving problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2015/10/01/unit-test-parallel-execution-of-static-classes-or-servicelocator/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Tips on compiling NuGetGallery source code and hosting it on IIS</title>
		<link>http://michaelsync.net/2015/09/29/tips-on-compiling-nugetgallery-source-code-and-hosting-it-on-iis</link>
		<comments>http://michaelsync.net/2015/09/29/tips-on-compiling-nugetgallery-source-code-and-hosting-it-on-iis#comments</comments>
		<pubDate>Tue, 29 Sep 2015 12:50:24 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Nuget]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2911</guid>
		<description><![CDATA[Last week, I tried compiling the source code of NuGetGallery and hosting it on IIS but found some issues. Here is the list of issues/solutions that I found. I am sharing it here. Hope it will save some of your times if you are facing the same issues. Note that I was using the master [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Last week, I tried compiling the source code of <a href="https://github.com/NuGet/NuGetGallery">NuGetGallery </a>and hosting it on IIS but found some issues. Here is the list of issues/solutions that I found. I am sharing it here. Hope it will save some of your times if you are facing the same issues.</p>
<p>Note that I was using the master branch and the date that I downloaded the source from that branch was 22/09/2015.</p>
<h2>Azure SDK</h2>
<p>The first error that I got was the compile error. It was because I don&#8217;t have an Azure SDK on my VM. Well, I know installing the Azure SDK is one of the prerequisites but I am not going to host it on Azure so I decided to change the path of two assemblies below in <a href="https://github.com/NuGet/NuGetGallery/blob/master/src/NuGetGallery/NuGetGallery.csproj">NuGetGallery.csproj</a>.</p>
<ul>
<li>Microsoft.WindowsAzure.Diagnostics.dll</li>
<li>Microsoft.WindowsAzure.ServiceRuntime.dll</li>
</ul>
<p>NuGet Gallery team shipped those assemblies under lib/AzureSDK so it&#8217;s quite easy to change it.</p>
<p><img class="alignnone size-large wp-image-2916" src="http://images.michaelsync.net/images/2015/09/Wrong-Path-of-Azure-DLL-1024x306.png" alt="Wrong Path of Azure DLL" width="700" height="209" srcset="http://michaelsync.net/wp-content/uploads/2015/09/Wrong-Path-of-Azure-DLL-1024x306.png 1024w, http://michaelsync.net/wp-content/uploads/2015/09/Wrong-Path-of-Azure-DLL-300x90.png 300w, http://michaelsync.net/wp-content/uploads/2015/09/Wrong-Path-of-Azure-DLL-700x209.png 700w, http://michaelsync.net/wp-content/uploads/2015/09/Wrong-Path-of-Azure-DLL.png 1136w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<h2>Entity Framework 5 + VS2013 Update 5 issue</h2>
<p>I got this error when I tried to update the database.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/22-09-2015-1-02-14-PM.png"><img class="alignnone size-full wp-image-2913" src="http://images.michaelsync.net/images/2015/09/22-09-2015-1-02-14-PM.png" alt="22-09-2015 1-02-14 PM" width="810" height="368" srcset="http://michaelsync.net/wp-content/uploads/2015/09/22-09-2015-1-02-14-PM.png 810w, http://michaelsync.net/wp-content/uploads/2015/09/22-09-2015-1-02-14-PM-300x136.png 300w, http://michaelsync.net/wp-content/uploads/2015/09/22-09-2015-1-02-14-PM-700x318.png 700w" sizes="(max-width: 810px) 100vw, 810px" /></a></p>
<p>It looks like a known issue with EF5+VS2013Update but I found the workaround <a href="https://github.com/NuGet/NuGetGallery/issues/2592#issuecomment-127189653" target="_blank">Update-Database throwing &#8220;Could not load file or assembly EntityFramework .. or one of its dependencies&#8221; error</a>.</p>
<p>The steps below is the workaround to fix this issue.</p>
<ul>
<li>Start VS Command Prompt as Administrator</li>
<li>Go to your packages directory and find the EntityFramework package directory.</li>
<li>Go to lib\net45</li>
<li>Type: gacutil /i EntityFramework.dll</li>
<li>Restart Visual Studio</li>
</ul>
<p>I managed to update the database after I did those steps but I got the runtime error below when I launch the NuGetGallery project.</p>
<blockquote><p>Failed to set Database.DefaultConnectionFactory to an instance of the &#8216;System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework&#8217; type as specified in the application configuration. See inner exception for details.</p>
<p>{&#8220;Could not load file or assembly &#8216;EntityFramework&#8217; or one of its dependencies. The system cannot find the file specified.&#8221;:&#8221;EntityFramework&#8221;}</p></blockquote>
<p>so I would suggest that you should uninstall EntityFramework.dll from GAC later.</p>
<pre>gacutil /u EntityFramework</pre>
<h2>RequireSsl</h2>
<p>It&#8217;s up to you whether you want to have SSL enabled or not. For me, I don&#8217;t need it so remove [RequireSsl] attribute from NuGetGallery/Controllers/<wbr></wbr>AuthenticationController.cs.</p>
<h2>Remove ReWrite</h2>
<p>I don&#8217;t want to enable http-rewrite module and when I look at the config, it looks like they are just using it for nuget.org only so I removed the whole re-write session from config.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/Remove-rewrite.png"><img class="alignnone size-large wp-image-2915" src="http://images.michaelsync.net/images/2015/09/Remove-rewrite-1024x783.png" alt="Remove rewrite" width="700" height="535" srcset="http://michaelsync.net/wp-content/uploads/2015/09/Remove-rewrite-1024x783.png 1024w, http://michaelsync.net/wp-content/uploads/2015/09/Remove-rewrite-300x229.png 300w, http://michaelsync.net/wp-content/uploads/2015/09/Remove-rewrite-700x535.png 700w, http://michaelsync.net/wp-content/uploads/2015/09/Remove-rewrite.png 1097w" sizes="(max-width: 700px) 100vw, 700px" /></a></p>
<h2>Enable-LocalTestMe</h2>
<p>If you are running it from VS, you will have to enable the local test me by running .\Enable-LocalTestMe.ps1 script unless you want to change the configuration manually. but your goal is just to host it on IIS then you don&#8217;t have to do it.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/Enable_localTestMeinIISExpress.png"><img class="alignnone size-full wp-image-2914" src="http://images.michaelsync.net/images/2015/09/Enable_localTestMeinIISExpress.png" alt="Enable_localTestMeinIISExpress" width="738" height="127" srcset="http://michaelsync.net/wp-content/uploads/2015/09/Enable_localTestMeinIISExpress.png 738w, http://michaelsync.net/wp-content/uploads/2015/09/Enable_localTestMeinIISExpress-300x52.png 300w, http://michaelsync.net/wp-content/uploads/2015/09/Enable_localTestMeinIISExpress-700x120.png 700w" sizes="(max-width: 738px) 100vw, 738px" /></a></p>
<h2>NuGet Push &#8220;Method Not Allowed&#8221; error</h2>
<p>After I manage to run NuGetGallery project, I got another small issue with nuget push.</p>
<p>[16:35:45][push] Failed to process request. &#8216;Method Not Allowed&#8217;.<br />
[16:35:45][push] The remote server returned an error: (405) Method Not Allowed..<br />
[16:35:45][push] Process exited with code 1<br />
[16:35:45][Step 6/6] Step Push To NuGet (NuGet Publish) failed</p>
<p>I removed &#8220;WebDEV&#8221; from http-handler and module. After that, it works.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://images.michaelsync.net/images/2015/09/WebDev.png"><img class="alignnone size-full wp-image-2920" src="http://images.michaelsync.net/images/2015/09/WebDev.png" alt="WebDev" width="551" height="764" srcset="http://michaelsync.net/wp-content/uploads/2015/09/WebDev.png 551w, http://michaelsync.net/wp-content/uploads/2015/09/WebDev-216x300.png 216w, http://michaelsync.net/wp-content/uploads/2015/09/WebDev-505x700.png 505w" sizes="(max-width: 551px) 100vw, 551px" /></a></p>
<p>I will probably upload the publish file and database schedule later this week or next week.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2015/09/29/tips-on-compiling-nugetgallery-source-code-and-hosting-it-on-iis/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Where is the EndPoint setting for VM in new Azure portal?</title>
		<link>http://michaelsync.net/2015/09/28/where-is-the-endpoint-setting-for-vm-in-new-azure-portal</link>
		<comments>http://michaelsync.net/2015/09/28/where-is-the-endpoint-setting-for-vm-in-new-azure-portal#comments</comments>
		<pubDate>Mon, 28 Sep 2015 22:23:59 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Microsoft Azure]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2899</guid>
		<description><![CDATA[The endpoint settings in VM allows us to configure the incoming traffic such as remote desktop, custom http ports (Teamcity, OctpusDeploy and etc.) to VM. It was pretty easy to find that setting on old HTML5 azure portal https://manage.windowsazure.com. But you can&#8217;t use the new type of VM with a resource manager on old portal so you [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>The endpoint settings in VM allows us to configure the incoming traffic such as remote desktop, custom http ports (Teamcity, OctpusDeploy and etc.) to VM. It was pretty easy to find that setting on old HTML5 azure portal https://manage.windowsazure.com.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/VM-EndPoint-Setting-in-old-Azure-portal.png"><img class="alignnone size-full wp-image-2903" src="http://images.michaelsync.net/images/2015/09/VM-EndPoint-Setting-in-old-Azure-portal.png" alt="VM EndPoint Setting in old Azure portal" width="595" height="246" srcset="http://michaelsync.net/wp-content/uploads/2015/09/VM-EndPoint-Setting-in-old-Azure-portal.png 595w, http://michaelsync.net/wp-content/uploads/2015/09/VM-EndPoint-Setting-in-old-Azure-portal-300x124.png 300w" sizes="(max-width: 595px) 100vw, 595px" /></a></p>
<p>But you can&#8217;t use the new type of VM with a resource manager on old portal so you have no choice but to use the new Azure portal https://portal.azure.com. The problem (at least for me) came when I wanted to open some ports (endpoints) on new VM via new portal. It took me a while to search for it so I thought I will share it here for those who might have same issue.</p>
<p>Let&#8217;s see what you will get when you create a new VM with a resource manager.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/Microsoft-Azure-Resource-Group.png"><img class="alignnone size-full wp-image-2905" src="http://images.michaelsync.net/images/2015/09/Microsoft-Azure-Resource-Group.png" alt="Microsoft Azure Resource Group" width="579" height="681" srcset="http://michaelsync.net/wp-content/uploads/2015/09/Microsoft-Azure-Resource-Group.png 579w, http://michaelsync.net/wp-content/uploads/2015/09/Microsoft-Azure-Resource-Group-255x300.png 255w" sizes="(max-width: 579px) 100vw, 579px" /></a></p>
<p>By default, you will get the following things when you create a VM but of course, you have an option to choose what to create or what to re-use during the setup.</p>
<ul>
<li>Virtual machine</li>
<li>Network Interface</li>
<li>Network Security Group</li>
<li>Public IP Address</li>
<li>Virtual network</li>
<li>Storage Account</li>
</ul>
<p>Choose &#8220;Network Security Group&#8221; then you will see the setting page that looks similar to Windows Advanced Firewall interface on windows server or desktop.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://images.michaelsync.net/images/2015/09/Azure-Network-Security-Group.png"><img class="alignnone size-full wp-image-2906" src="http://images.michaelsync.net/images/2015/09/Azure-Network-Security-Group.png" alt="Azure Network Security Group" width="887" height="590" srcset="http://michaelsync.net/wp-content/uploads/2015/09/Azure-Network-Security-Group.png 887w, http://michaelsync.net/wp-content/uploads/2015/09/Azure-Network-Security-Group-300x200.png 300w, http://michaelsync.net/wp-content/uploads/2015/09/Azure-Network-Security-Group-700x466.png 700w" sizes="(max-width: 887px) 100vw, 887px" /></a></p>
<p>Click on &#8220;Inbound security rules&#8221;. This is where you can enable the endpoint of your new VM. Of course, you forget to open the same port in your server OS as well.</p>
<p><a href="http://images.michaelsync.net/images/2015/09/Azure-VM-Firewall1.png"><img class="alignnone size-large wp-image-2908" src="http://images.michaelsync.net/images/2015/09/Azure-VM-Firewall1-1024x481.png" alt="Azure VM Firewall" width="700" height="329" srcset="http://michaelsync.net/wp-content/uploads/2015/09/Azure-VM-Firewall1-1024x481.png 1024w, http://michaelsync.net/wp-content/uploads/2015/09/Azure-VM-Firewall1-300x141.png 300w, http://michaelsync.net/wp-content/uploads/2015/09/Azure-VM-Firewall1-700x329.png 700w, http://michaelsync.net/wp-content/uploads/2015/09/Azure-VM-Firewall1.png 1485w" sizes="(max-width: 700px) 100vw, 700px" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2015/09/28/where-is-the-endpoint-setting-for-vm-in-new-azure-portal/feed</wfw:commentRss>
		<slash:comments>52</slash:comments>
		</item>
		<item>
		<title>Azure Website: ERROR_PROXY_GATEWAY in deploying an Azure website using MSDeploy from TeamCity</title>
		<link>http://michaelsync.net/2014/11/08/azure-website-error_proxy_gateway-in-deploying-an-azure-website-using-msdeploy-from-teamcity</link>
		<comments>http://michaelsync.net/2014/11/08/azure-website-error_proxy_gateway-in-deploying-an-azure-website-using-msdeploy-from-teamcity#comments</comments>
		<pubDate>Sat, 08 Nov 2014 16:13:39 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Microsoft Azure]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2867</guid>
		<description><![CDATA[Error Message [14:33:45][VSMSDeploy] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4270, 5): error ERROR_PROXY_GATEWAY: Web deployment task failed. (Could not connect to the remote computer (&#8220;[yoursite].azurewebsites.net&#8221;) using the specified process (&#8220;Web Management Service&#8221;). This can happen if a proxy server is interrupting communication with the destination server. Disable the proxy server and try again. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_PROXY_GATEWAY.) Solution There [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>Error Message</strong></p>
<p>[14:33:45][VSMSDeploy] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4270, 5): error <strong>ERROR_PROXY_GATEWAY</strong>: Web deployment task failed. (Could not connect to the remote computer (&#8220;[yoursite].azurewebsites.net&#8221;) using the specified process (&#8220;Web Management Service&#8221;). This can happen if a proxy server is interrupting communication with the destination server. Disable the proxy server and try again. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_PROXY_GATEWAY.)</p>
<p><strong>Solution</strong></p>
<p>There is an <a title="Web Deploy error codes" href="http://www.iis.net/learn/publish/troubleshooting-web-deploy/web-deploy-error-codes">official page that contains the list of error codes and possible resolution</a> from IIS. What was suggested for ERROR_PROXY_GATEWAY is as below.</p>
<blockquote><p>Diagnosis &#8211; A proxy gateway is preventing Web Deploy from communicating with the remote Web Deploy endpoint.Resolution &#8211; Web Deploy does not read system proxy settings. As a workaround, try disabling the system proxy:</p>
<ul type="disc">
<li>Start Internet Explorer</li>
<li>Click Tools &gt; Options</li>
<li>Click Connection</li>
<li>Click LAN Settings</li>
<li>Disable all checkboxes</li>
</ul>
</blockquote>
<p>It didn&#8217;t really help me directly because my build server is on Azure data center in same region where I host my test site and it used to work all the time since long time back. But when I tried to rdp the server then I found that there is a alert for the server restart. So, it seems to me that when the server needed to be restarted then it might limit the connection or something. I was still able to connect the team city website but it was just that msdeploy didn&#8217;t work so I did the restart and everything&#8217;s back to normal again.</p>
<p><strong>So, if you are getting the same error all of a sudden, try to rdp to your server and see whether there is a restart alert or not. </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2014/11/08/azure-website-error_proxy_gateway-in-deploying-an-azure-website-using-msdeploy-from-teamcity/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Azure WebJob Issue after package update &#8211; Host is not running</title>
		<link>http://michaelsync.net/2014/11/06/azure-webjob-issue-after-package-update-host-is-not-running</link>
		<comments>http://michaelsync.net/2014/11/06/azure-webjob-issue-after-package-update-host-is-not-running#comments</comments>
		<pubDate>Fri, 07 Nov 2014 06:40:32 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Microsoft Azure]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2860</guid>
		<description><![CDATA[It took me a while to get the solution for this problem and Google gave me nothing when I search the error (warning) message so I thought its worth to share it here with you all. Problem Error Message: Host is not running; requests will be queued but not execute until the host is started Screenshot [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>It took me a while to get the solution for this problem and Google gave me nothing when I search the error (warning) message so I thought its worth to share it here with you all.</p>
<h2>Problem</h2>
<p>Error Message: <strong>Host is not running; requests will be queued but not execute until the host is started</strong></p>
<p><strong>Screenshot</strong></p>
<p><a href="http://images.michaelsync.net/images/2014/11/Web-Job-Issue.png"><img class="alignnone size-large wp-image-2862" src="http://images.michaelsync.net/images/2014/11/Web-Job-Issue-1024x603.png" alt="Web Job Issue" width="700" height="412" srcset="http://michaelsync.net/wp-content/uploads/2014/11/Web-Job-Issue-1024x603.png 1024w, http://michaelsync.net/wp-content/uploads/2014/11/Web-Job-Issue-300x176.png 300w, http://michaelsync.net/wp-content/uploads/2014/11/Web-Job-Issue-700x412.png 700w, http://michaelsync.net/wp-content/uploads/2014/11/Web-Job-Issue.png 1164w" sizes="(max-width: 700px) 100vw, 700px" /></a></p>
<h2>Solution</h2>
<p>It happened because of the breaking changes in Beta 0.5 version. Azure used to have the problem with same name in different region due to their caching. I beleive that some parts of Azure tools like &#8216;Visual Studio&#8217;s publish dialog to azure&#8217; and &#8216;SCM&#8217; were not built to support the &#8220;same name/multiple regions&#8221; or multiple subscriptions in mind. I reported about &#8220;<a title="Problem: Issue with multiple Azure subscriptions with same name" href="http://michaelsync.net/2013/11/02/windows-azure-deployment-problem-and-solution-2" target="_blank">Problem: Issue with multiple Azure subscriptions with same name&#8221;</a> before.</p>
<p><strong>The solution for this issue is to make the class and method public</strong>. It&#8217;s an unusual practice for console programs but it&#8217;s how it is and it works.</p>
<pre class="brush: plain; title: ; notranslate">

public class Program {

private static Logger _logger = LogManager.GetCurrentClassLogger();

public static void Main(string[] args) {
_logger.Info(&amp;quot;Test Main Started&amp;quot;);
var host = new JobHost();
host.RunAndBlock();
_logger.Info(&amp;quot;Test Main Ended&amp;quot;);
}

public static async Task TestAsync([QueueTrigger(&amp;quot;testqueue&amp;quot;)] string _) {
_logger.Info(&amp;quot;TestAsync Started&amp;quot;);
await Task.Delay(30);
_logger.Info(&amp;quot;TestAsync Ended&amp;quot;);
}
}

</pre>
<p>And if you toggle the output of your webjob in SCM, you will see this log below. Then you will know that you need to make the class and methods public.</p>
<blockquote><p>[INFO] No functions found. Try making job classes public and methods public static.</p></blockquote>
<p>So, That&#8217;s it. Hope it helps saving some of your time.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2014/11/06/azure-webjob-issue-after-package-update-host-is-not-running/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Gmail password leaks download? For real? Tvskit &#8211; btcsec</title>
		<link>http://michaelsync.net/2014/09/10/gmail-password-leaks-download-for-real-tvskit-btcsec</link>
		<comments>http://michaelsync.net/2014/09/10/gmail-password-leaks-download-for-real-tvskit-btcsec#comments</comments>
		<pubDate>Wed, 10 Sep 2014 17:20:26 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2844</guid>
		<description><![CDATA[A lot of people are changing their Gmail passwords since the news on 5 million Gmail passwords leaked widely spread all over the internet today. According to the new, the user &#8220;Tvskit&#8221; posted the zip file with the following screenshots in Russion Bitcoin forum. Some sources said that the passwords in that file are 60% accurate [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>A lot of people are changing their Gmail passwords since the news on 5 million Gmail passwords leaked widely spread all over the internet today. According to the new, the user &#8220;Tvskit&#8221; posted the zip file with the following screenshots in Russion Bitcoin forum.</p>
<p><a href="http://images.michaelsync.net/images/2014/09/Tvskit-Gmail-Password-Leak.jpg"><img class="alignnone size-full wp-image-2846" src="http://images.michaelsync.net/images/2014/09/Tvskit-Gmail-Password-Leak.jpg" alt="Tvskit - Gmail Password Leak" width="350" height="286" srcset="http://michaelsync.net/wp-content/uploads/2014/09/Tvskit-Gmail-Password-Leak.jpg 350w, http://michaelsync.net/wp-content/uploads/2014/09/Tvskit-Gmail-Password-Leak-300x245.jpg 300w" sizes="(max-width: 350px) 100vw, 350px" /></a></p>
<p>Some sources said that the passwords in that file are 60% accurate but old passwords. I followed a few links to get the zip files from different source (including the original btcsec website) and extracted them on a VM. Here is the list of links that I downloaded the files. (Note: I intentionally didn&#8217;t link them from my blog. ) <a href="http://images.michaelsync.net/images/2014/09/Gmail-Password-Downloads.png"><img class="alignnone size-full wp-image-2847" src="http://images.michaelsync.net/images/2014/09/Gmail-Password-Downloads.png" alt="Gmail Password Downloads" width="601" height="367" srcset="http://michaelsync.net/wp-content/uploads/2014/09/Gmail-Password-Downloads.png 601w, http://michaelsync.net/wp-content/uploads/2014/09/Gmail-Password-Downloads-300x183.png 300w" sizes="(max-width: 601px) 100vw, 601px" /></a></p>
<p>Here is the size of those Gmail passwords files that I downloaded. <a href="http://images.michaelsync.net/images/2014/09/Gmail-Password-Download-Sizes.png"><img class="alignnone size-full wp-image-2848" src="http://images.michaelsync.net/images/2014/09/Gmail-Password-Download-Sizes.png" alt="Gmail Password Download Sizes" width="549" height="183" srcset="http://michaelsync.net/wp-content/uploads/2014/09/Gmail-Password-Download-Sizes.png 549w, http://michaelsync.net/wp-content/uploads/2014/09/Gmail-Password-Download-Sizes-300x100.png 300w" sizes="(max-width: 549px) 100vw, 549px" /></a></p>
<p>If you are planning to download those files from those websites that I posted in screenshot and the size are the same, don&#8217;t bother downloading it. Because those files don&#8217;t contain any password and it&#8217;s just the list of user names. (4929083 accounts in totals)</p>
<p><a href="http://images.michaelsync.net/images/2014/09/Gmail-password-leaks-but-no-password.png"><img class="alignnone size-full wp-image-2849" src="http://images.michaelsync.net/images/2014/09/Gmail-password-leaks-but-no-password.png" alt="Gmail password leaks but no password" width="488" height="507" srcset="http://michaelsync.net/wp-content/uploads/2014/09/Gmail-password-leaks-but-no-password.png 488w, http://michaelsync.net/wp-content/uploads/2014/09/Gmail-password-leaks-but-no-password-288x300.png 288w" sizes="(max-width: 488px) 100vw, 488px" /></a></p>
<p>A user &#8220;<a href="http://www.reddit.com/user/cDull">cDull</a>&#8221; from reddits also shared what they think about what happened as below in this post &#8220;<a href="http://www.reddit.com/r/netsec/comments/2fz13q/5_millions_of_gmail_passwords_leaked_rus_most/">5 Millions of &#8220;Gmail&#8221; passwords leaked [RUS], most likely it&#8217;s a compilation of passwords from other sites</a>&#8221;</p>
<blockquote><p>That is pretty smart of you, and there are many others that had same idea. Just do a grep for &#8216;+&#8217; in the gmail account dump and you see a lot of eharmony, filedrop, friendster, bravenet, bioware, savage, xtube, and others if you do the command below. There might be more than 20 different website references in there. This is definitely a compilation and a bunch of bullshit FUD.</p></blockquote>
<pre class="brush: plain; title: ; notranslate">

grep '+' google_5000000.txt | cut -d+ -f2 | cut -d@ -f1 | sort | uniq -c | sort -h | tail -n 21
18 bravenet
18 filesavr
19 policeauctions
25 4
27 eh
28 3
32 freebiejeebies
40 hon
51 bryce
52 savage2
54 bioware
57 spam
60 2
62 savage
63 friendster
64 eharmony
66 daz3d
88 filedropper
125 1
132 daz
176 xtube

</pre>
<p>If you managed to get the file then don&#8217;t forget to use a VM before extracting the file. Of course, you have the file with passwords then let me know..</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2014/09/10/gmail-password-leaks-download-for-real-tvskit-btcsec/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Most annoying thing in Visual Studio</title>
		<link>http://michaelsync.net/2014/08/10/most-annoying-thing-in-visual-studio</link>
		<comments>http://michaelsync.net/2014/08/10/most-annoying-thing-in-visual-studio#comments</comments>
		<pubDate>Sun, 10 Aug 2014 15:49:22 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2835</guid>
		<description><![CDATA[Here is my most annoying thing in Visual Studio. What about yours? I have my MVP MSDN subscription, Dreamspark (Ya, I am still a student), BizSpark (with my friends)  for many years. This dialog pop-up once in a while to annoy me. Ya. it happened with VS express version that is totally free as well. Who [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Here is my most annoying thing in Visual Studio. What about yours?</p>
<p>I have my MVP MSDN subscription, Dreamspark (Ya, I am still a student), BizSpark (with my friends)  for many years. This dialog pop-up once in a while to annoy me. Ya. it happened with VS express version that is totally free as well. Who the fuck are you to keep on validating your own royal customers? Is it your best marketing strategy?</p>
<p>I guess some program managers who decided to force (instead of encourage) VS users should be a part of this year&#8217;s cut (18K? )</p>
<p>It doesn&#8217;t matter how much I love Microsoft technology. but I hate when I am being forced.</p>
<p><a href="http://images.michaelsync.net/images/2014/08/Most-anoying-things-in-VS.png"><img class="alignnone size-full wp-image-2838" src="http://images.michaelsync.net/images/2014/08/Most-anoying-things-in-VS.png" alt="Most anoying things in VS" width="802" height="490" srcset="http://michaelsync.net/wp-content/uploads/2014/08/Most-anoying-things-in-VS.png 802w, http://michaelsync.net/wp-content/uploads/2014/08/Most-anoying-things-in-VS-300x183.png 300w" sizes="(max-width: 802px) 100vw, 802px" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2014/08/10/most-annoying-thing-in-visual-studio/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Status of FxCop/Code Analysis! &#8211; Is FxCop still being maintained?</title>
		<link>http://michaelsync.net/2014/07/19/status-of-fxcop-code-analysis</link>
		<comments>http://michaelsync.net/2014/07/19/status-of-fxcop-code-analysis#comments</comments>
		<pubDate>Sat, 19 Jul 2014 15:34:21 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[FxCop/Code Analysis]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2789</guid>
		<description><![CDATA[Short version The old version IL-based FxCop/CA are dead but the new version of CA that based on source-code instead of IL will be in VS &#8220;14&#8221;.  (You can scroll down and see the reply from Alex Turner, the owner for Diagnostics in managed languages. ) Long version Yes, I was a huge fan of [&#8230;]]]></description>
				<content:encoded><![CDATA[<h1>Short version</h1>
<p>The old version IL-based FxCop/CA are dead but the new version of CA that based on source-code instead of IL will be in VS &#8220;14&#8221;.  (You can scroll down and see the reply from Alex Turner, the owner for Diagnostics in managed languages. )</p>
<h1>Long version</h1>
<p>Yes, I was a huge fan of FxCop/Code Analysis. I <del>forced</del> encouraged everyone in my team to make FxCop/CA happy for every single line of code before they commit. FxCop/CA does help to make sure your code is still following <a href="http://msdn.microsoft.com/en-us/library/ms229042(v=vs.110).aspx" target="_blank">Framework Design Guidelines</a> without assigning some experts to do the manual code review for every commits.</p>
<p>Note: If you are not familiar with FxCop/CA then you can read about them in the following links (<a title="FxCop - MSDN" href="http://msdn.microsoft.com/en-us/library/bb429476(v=vs.80).aspx" target="_blank">FxCop</a>, <a title="Code Analysis for Managed Code Overview" href="http://msdn.microsoft.com/en-us/library/3z0aeatx.aspx" target="_blank">Code Analysis</a> and <a href="http://social.msdn.microsoft.com/Forums/vstudio/en-US/800973d2-4f85-43d3-ae89-5775b2e4918f/fxcop-vs-vs2012-code-analysis?forum=vsdebug" target="_blank">FxCop Vs. Code Analysis</a>)</p>
<p>We all know that Microsoft has released a few versions of .NET framework. When was FxCop&#8217;s last release? I reported the following issues that we have with FxCop/CA but I didn&#8217;t see those issues are being addressed.</p>
<ul>
<li><a title="Bug – Code Analysis doesn’t work well with async methods even in Visual Studio 2013" href="http://michaelsync.net/2013/09/26/bug-code-analysis-doesnt-work-well-with-async-methods-even-in-visual-studio-2013" target="_blank">Bug – Code Analysis doesn’t work well with async methods even in Visual Studio 2013</a></li>
<li><a href="http://michaelsync.net/2013/05/28/unsolved-fxcop-portable-library" target="_blank">(Unsolved) FxCop + Portable Library</a></li>
<li><a href="http://michaelsync.net/2013/05/25/tip-fxcop-issue-with-system-net-http" target="_blank">Tip: FxCop issue with System.Net.Http</a></li>
</ul>
<p>The worst part is that some teams (e.g. MVC/Web API team) from Microsoft are not even following the FxCop&#8217;s rules. I posted this questions &#8220;<a href="http://forums.asp.net/t/1995557.aspx?Why+a+fresh+new+MVC+project+couldn+t+pass+the+Code+Analysis+One+Microsoft" target="_blank">Why a fresh new MVC project couldn&#8217;t pass the Code Analysis? One-Microsoft</a>&#8221; in MSDN forum as well.</p>
<p>I am the one who is encouraging the team to follow FxCop in company but I wasn&#8217;t sure why the issues that have been reported a while back are still not being addressed. I wasn&#8217;t even sure whether Microsoft is still maintaining the FxCop or not so I tried to reach out to Microsoft team internally and luckily, I got the answer.</p>
<p><strong>Here is the unedited reply from Alex Turner, the owner for Diagnostics in managed languages. I am sharing his email with everyone (including my teams) with his permissions. </strong></p>
<p>Hi Michael,</p>
<p>FxCop has indeed been dormant for a while, and it’s certainly become stale in the face of new C# language features like async. My favorite instance of that is the cyclomatic complexity rule – FxCop will complain that an empty async method has too branches for you to easily maintain, even when it contains no code J</p>
<p>This is all due to FxCop analyzing IL rather than source. That worked great in the C# 1.0/2.0 days when the code you wrote mapped almost directly to IL – rules could look at that IL and work out what the source was. However, heavier transforms like LINQ and async get you too far from the code that was written to give good guidance on anything except method/type naming and IL-level performance tweaks. In the face of such decaying rules, it’s unfortunate but not surprising to me that other Microsoft teams are skipping the dance required to stay FxCop-clean.</p>
<p>For VS “14”, we’re investing heavily in source-based code analysis, built using Roslyn. This not only gives back the fidelity we’ve been missing in async methods and other high-level constructs – it also lets us surface code analysis issues live as you’re typing, even before your code fully builds, since we’re operating on the same syntax trees and symbols that IntelliSense uses. We’re also surfacing a supported API for plugging such rules into the compiler as you build, so that API authors and other third parties finally have a supported way to build such analysis, rather than hacking it into FxCop.</p>
<p>As Christoph pointed out, we’re proving out our new Roslyn-based diagnostics by reimplementing the high-value, low-false-positive FxCop rules using Roslyn. We haven’t yet decided when to pull the switch and officially swap out the IL-based FxCop rules for rules built on Roslyn, but the new live analysis engine will be built into the C#/VB compilers in VS “14” (it’s already in the CTP). At a minimum, we’ll ship this set of rules online, as an opt-in package you can use instead of the built-in VS support.</p>
<p>Alex Turner<br />
Senior Program Manager<br />
Managed Languages</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>The conclusion is that the old version IL-based FxCop/CA are dead but the new version that based on source-code analysis instead of IL will be in VS &#8220;14&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2014/07/19/status-of-fxcop-code-analysis/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>[Quora] &#8211; Advice from someone who made $15 millions after selling the tech startup.</title>
		<link>http://michaelsync.net/2014/07/17/quora-advice-from-someone-who-made-15-millions-after-selling-the-tech-startup</link>
		<comments>http://michaelsync.net/2014/07/17/quora-advice-from-someone-who-made-15-millions-after-selling-the-tech-startup#comments</comments>
		<pubDate>Thu, 17 Jul 2014 15:21:24 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2802</guid>
		<description><![CDATA[I came across this awesome answer to the question &#8220;Is getting rich worth it?&#8221; on Quora site. I have no idea who posted this great answer but I just feel like it&#8217;s worth sharing with you all.  (Note: I did read the terms of service from quora and I am allowed to share it with the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I came across this awesome answer to the question &#8220;<a href="http://www.quora.com/Wealth/Is-getting-rich-worth-it">Is getting rich worth it?</a>&#8221; on Quora site. I have no idea who posted this great answer but I just feel like it&#8217;s worth sharing with you all.  (Note: I did read the terms of service from quora and I am allowed to share it with the link to the original post.)</p>
<p>I made $15m in my mid-20s after I sold a tech startup. I talked to a lot of people about this question, and thought a lot about how to stay the same person I was before and after making money.</p>
<p><strong>Here&#8217;s my answer: being rich is better than not being rich, but it&#8217;s not nearly as good as you imagine it is.</strong></p>
<p>The answer why is a bit more complicated.</p>
<p>First, one of the only real things being rich gives you is that you don&#8217;t have to worry about money as much anymore. There will still be some expenses that you cannot afford (and you will wish you could), but most expenses can be made without thinking about what it costs. This is definitely better, without a doubt.</p>
<p>Being rich does come with some downsides, though. The first thing you are thinking reading that, is, &#8220;cry me a river&#8221;. That is one of the downsides. You are not allowed to complain about anything, ever. Since most people imagine being rich as nirvana, you are no longer allowed to have any human needs or frustrations in the public eye. Yet, you are still a human being, but most people don&#8217;t treat you like one.</p>
<p>There&#8217;s the second downside. Most people now want something out of you, and it can be harder to figure out whether someone is being nice to you because they like you, or they are being nice to you because of your money. If you aren&#8217;t married yet, good luck trying to figure out (and/or always having self doubt) about whether a partner is into you or your money.</p>
<p>Then you have friends &amp; family. Hopefully your relationship with them doesn&#8217;t sour, but it can get harder. Both can get really weird about it and start to treat you differently. They might come and ask for a loan (bad idea: if you give, always give a gift). One common problem is that they don&#8217;t appreciate Christmas presents the way that they used to, and they can get unrealistic expectations for how large a present should be and be disappointed when you don&#8217;t meet their unrealistic expectations. You have to start making decisions for your parents on what does and does not cost too much, and frankly, it&#8217;s awkward.</p>
<p>Add all of these up and you can start to feel a certain sense of isolation.</p>
<p>You sometimes lay awake at night, wondering if you made the right investment decisions, whether it might all go away. You know that feeling standing on a tall building, the feeling you might lose your mind and jump? Sometimes you&#8217;re worried that you might lose your mind and spend it all.</p>
<p>The next thing you need to understand about money is this: all of the things you picture buying, they are only worthwhile to you because you cannot afford them (or have to work really hard to acquire them). Maybe you have your eye on a new Audi &#8212; once you can easily afford it, it just doesn&#8217;t mean as much to you anymore.</p>
<p>Everything is relative, and you are more or less powerless to that. Yes, the first month you drive the Audi, or eat in a fancy restaurant, you really enjoy it. But then you sort of get used to it. And then you are looking towards the next thing, the next level up. And the problem is that you have reset your expectations, and everything below that level doesn&#8217;t get you quite as excited anymore.</p>
<p>This happens to everyone. Good people can maintain perspective, actively fight it, and stay grounded. Worse people complain about it and commit general acts of douchebaggery. But remember this: it would happen to you, too, even though you might not think so. You&#8217;ll just have to trust me on this one.</p>
<p>Most people hold the illusion that if only they had more money, their life would be better and they would be happier. Then they get rich, and that doesn&#8217;t happen, and it can throw them into a serious life crisis.</p>
<p>If you&#8217;re part of the middle class, you have just as many opportunities to do with your life what you want of it. If you&#8217;re not happy now, you won&#8217;t be happy because of money.</p>
<p>Whether you&#8217;re rich or not, make your life what you want it to be, and don&#8217;t use money as an excuse. Go out there, get involved, be active, pursue your passion, and make a difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2014/07/17/quora-advice-from-someone-who-made-15-millions-after-selling-the-tech-startup/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Polymer &#8211; Tips on running &#8220;Getting Started Tutorial&#8221; on Windows</title>
		<link>http://michaelsync.net/2014/07/08/polymer-tips-on-running-getting-started-tutorial-on-windows</link>
		<comments>http://michaelsync.net/2014/07/08/polymer-tips-on-running-getting-started-tutorial-on-windows#comments</comments>
		<pubDate>Tue, 08 Jul 2014 10:56:52 +0000</pubDate>
		<dc:creator><![CDATA[Michael Sync]]></dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=2792</guid>
		<description><![CDATA[Yes. As the title say, this post is about tips on how you can run Polymer sample on Windows. &#160; IIS instead of python server In Google&#8217;s Polymer document, it suggests you to run the following python command to start the web server. python -m SimpleHTTPServer python -m http.server But most of windows developers doesn&#8217;t have [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Yes. As the title say, this post is about tips on how you can run Polymer sample on Windows.<br />
<a href="http://images.michaelsync.net/images/2014/07/p-logo.png"><img class="alignnone size-full wp-image-2794" src="http://images.michaelsync.net/images/2014/07/p-logo.png" alt="p-logo" width="416" height="286" srcset="http://michaelsync.net/wp-content/uploads/2014/07/p-logo.png 416w, http://michaelsync.net/wp-content/uploads/2014/07/p-logo-300x206.png 300w" sizes="(max-width: 416px) 100vw, 416px" /></a></p>
<p>&nbsp;</p>
<h1>IIS instead of python server</h1>
<p>In Google&#8217;s <a href="http://www.polymer-project.org/" target="_blank">Polymer</a> document, it suggests you to run the following python command to start the web server.</p>
<blockquote><p>python -m SimpleHTTPServer</p>
<p>python -m http.server</p></blockquote>
<p>But most of windows developers doesn&#8217;t have the python installed on our windows machine. What else do we have? Yes. Most of us have the IIS so you can simply create a website and point to &#8220;polymer-tutorial-master&#8221; folder in IIS. That is.</p>
<h1>.json extension in IIS</h1>
<p>When you are working on &lt;post-list&gt; component tutorial, you will know that you are not able to show the list. It&#8217;s because the post-service is doing http-get to /posts.json file from the web server. IIS doesn&#8217;t have the .json extension by default. (Note: I am using IIS 7.5.)</p>
<p><a href="http://images.michaelsync.net/images/2014/07/MEME-Type-in-IIS7.png"><img class="alignnone size-full wp-image-2795" src="http://images.michaelsync.net/images/2014/07/MEME-Type-in-IIS7.png" alt="MEME Type in IIS7" width="316" height="271" srcset="http://michaelsync.net/wp-content/uploads/2014/07/MEME-Type-in-IIS7.png 316w, http://michaelsync.net/wp-content/uploads/2014/07/MEME-Type-in-IIS7-300x257.png 300w" sizes="(max-width: 316px) 100vw, 316px" /></a></p>
<p>So, I added the .json extension in MIME and then it works. If you want to see the step by step how to add new MIME in IIS then you can refer to this post &#8220;<a href="http://www.uipress.com/add-json-handler-support-in-iis-7/" target="_blank">add .json handler support in IIS 7</a>&#8220;. But for me, I didn&#8217;t add the handler for .json.</p>
<p>After adding the .json MIME in IIS then go and refresh the page. You will see the list as below.</p>
<p><a href="http://images.michaelsync.net/images/2014/07/Polymer.png"><img class="alignnone size-large wp-image-2796" src="http://images.michaelsync.net/images/2014/07/Polymer-1024x359.png" alt="Polymer" width="700" height="245" srcset="http://michaelsync.net/wp-content/uploads/2014/07/Polymer-1024x359.png 1024w, http://michaelsync.net/wp-content/uploads/2014/07/Polymer-300x105.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a></p>
<p>Polymer is a very interesting project that based on web components. But yes, it reminds me of my Silverlight/WPF days where I used to deal with template/data templates. I am still studying more about this project and hopefully, I can share my experience with Polymer with you all later.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2014/07/08/polymer-tips-on-running-getting-started-tutorial-on-windows/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->