<?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>Alex's dev blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/albulank/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/albulank/feed.xml</link>
    <description>sharing thoughts on my work and tools</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:06:46 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Customizing AppInsights end-user location recording</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/customizing-appinsights-end-user-location-recording</link>
      <pubDate>Mon, 09 May 2016 14:44:28 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/?p=235</guid>
      <description><![CDATA[If you are using AppInsights JavaScript SDK, you probably noticed that all telemetry has location...]]></description>
      <content:encoded><![CDATA[If you are using AppInsights JavaScript SDK, you probably noticed that all telemetry has location associated with it.

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/18.jpg"><img class="alignnone size-full wp-image-237" src="https://msdnshared.blob.core.windows.net/media/2016/05/18.jpg" alt="1" width="768" height="418" /></a>

&nbsp;

It is generally very handy when investigating region-specific issues or analyzing end-user client performance, however sometimes compliance or other reasons prevent you from recording end-user location or you would like to override it based on your custom logic.

Location is determined by our data collection endpoint from the IP address when SDK is issuing dc.services.visuastudio.com/track request. However it only uses the IP of the request, when IP in the telemetry item context is not specified. So when you specify IP address as part of telemetry item, it uses this IP to determine location, and, when this IP is specified as 0, it doesn't resolve the end-user location. To specify custom IP for all telemetry with JS SDK, add this telemetry initializer immediately after the snippet and before trackPageViewCall().
<pre><strong>        </strong>window.appInsights = appInsights;
<span style="color: #003300">        // Add telemetry initializer</span>
        appInsights.queue.push(function () {
        appInsights.context.addTelemetryInitializer(function (envelope) {
          envelope.tags[<strong><span style="color: #993300">"ai.location.ip"</span></strong>] = <strong><span style="color: #993300">"0"</span></strong>; <span style="color: #003300">//0 to hide or an IP address to resolve to location</span>
        });
        });
<span style="color: #003300">        // end of insertion</span>
        appInsights.trackPageView();</pre>
For more information on telemetry initializers for JavaScript SDK, please see <a href="https://blogs.msdn.microsoft.com/albulank/2016/04/20/modifying-and-filtering-telemetry-with-appinsights-javascript-sdk-telemetry-initializer/" target="_blank">this blog post</a>.

Feedback, comments? Let me know what you think.

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Extending AppInsights Sampling to Specify Telemetry Types</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/extending-appinsights-telemetry-processor-to-specify-what-types-to-sample</link>
      <pubDate>Fri, 29 Apr 2016 07:16:48 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/?p=225</guid>
      <description><![CDATA[Starting with v.2.0 of .NET AppInsights SDK sampling is enabled by default in...]]></description>
      <content:encoded><![CDATA[Starting with v.2.0 of .NET AppInsights SDK<a href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-filtering-sampling/" target="_blank"> sampling is enabled by default in ApplicationInsights.config</a>. There are two options available for sampling: <a href="https://github.com/Microsoft/ApplicationInsights-dotnet/blob/master/src/TelemetryChannels/ServerTelemetryChannel/Shared/SamplingTelemetryProcessor.cs" target="_blank">SamplingTelemetryProcessor</a> (fixed rate) and <a href="https://github.com/Microsoft/ApplicationInsights-dotnet/blob/master/src/TelemetryChannels/ServerTelemetryChannel/Shared/AdaptiveSamplingTelemetryProcessor.cs" target="_blank">AdaptiveSamplingTelemetryProcessor</a>. One limitation of current solution is that customer cannot choose what telemetry types to sample - sampling is applied to all telemetry types except custom metrics. In the upcoming versions of .NET SDK, we will address this problem (there's already an API proposal), however at the meantime here's a what you can do to choose what telemetry types you would like to sample.
<ol>
	<li>Create a telemetry processor, let's call it <strong>ConfigurableAdaptiveSamplingTelemetryProcessor</strong>. This is<strong> t<a href="https://github.com/AlexBulankou/ai-samples/blob/master/ConfigurableAdaptiveSamplingTelemetryProcessor.cs" target="_blank">he code that you can you can just add to your project</a></strong>.</li>
	<li>Replace AdaptiveTelemetryProcessor in your ApplicationInsights.config with ConfigurableAdaptiveSamplingTelemetryProcessor from your assembly. In my case I only would like to sample requests and dependencies, and always sent all other telemetry types:</li>
</ol>
<pre><span style="color: #003366"> &lt;!--</span>
 <span style="color: #008000">&lt;Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel"&gt;</span>
<span style="color: #008000">   &lt;MaxTelemetryItemsPerSecond&gt;5&lt;/MaxTelemetryItemsPerSecond&gt;</span>
<span style="color: #008000"> &lt;/Add&gt;</span>
 <span style="color: #003366">--&gt;</span>
 <span style="color: #003366">&lt;</span>Add Type="<span style="color: #003366">Microsoft.ApplicationInsights.Samples.<strong>ConfigurableAdaptiveSamplingTelemetryProcessor</strong>, &lt;YourAssemblyName&gt;</span>"<span style="color: #003366">&gt;</span>
   <span style="color: #003366">&lt;</span><span style="color: #800000">MaxTelemetryItemsPerSecond</span><span style="color: #003366">&gt;</span><strong>5</strong>&lt;/<span style="color: #800000">MaxTelemetryItemsPerSecond</span>&gt;
   &lt;<span style="color: #800000">SampledTelemetry</span><span style="color: #003366">&gt;</span><strong>Request;Dependency</strong><span style="color: #003366">&lt;/</span><span style="color: #800000">SampledTelemetry</span><span style="color: #003366">&gt;</span>
 &lt;/Add&gt;
</pre>
And this is all you need. Possible values for SampledTelemetry are request, dependency, event, exception, pageview, performancecounter, trace, metric. One caveat is that if you specify empty list, no telemetry types will be sampled - but you can change this logic. You can also apply the same approach to customize SamplingTelemetryProcessor (fixed rate).

Looking forward to your feedback - what else would you like to customize in our default sampling functionality?]]></content:encoded>
    </item>
    <item>
      <title>Modifying and Filtering Telemetry with AppInsights JavaScript SDK Telemetry Initializer</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/modifying-and-filtering-telemetry-with-appinsights-javascript-sdk-telemetry-initializer</link>
      <pubDate>Wed, 20 Apr 2016 17:29:28 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/?p=205</guid>
      <description><![CDATA[Telemetry Initializers and, more recently, Telemetry Processors, is now quite well known and used...]]></description>
      <content:encoded><![CDATA[<a href="https://apmtips.com/blog/2014/12/01/telemetry-initializers/" target="_blank">Telemetry Initializers</a> and, more recently, <a href="https://azure.microsoft.com/en-us/blog/request-filtering-in-application-insights-with-telemetry-processor/" target="_blank">Telemetry Processors</a>, is now quite well known and used for .NET SDK. However from the forum questions we are discovering, that not as many customers are aware, that AppInsights <strong>JavaScript SDK</strong> also supports simple, but very powerful Telemetry Initializer concept, which allows to modify and filter your data.

<a title="API reference for Telemetry Initializer" href="https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#addTelemetryInitializer" target="_blank">This is API reference</a> for telemetry initializer for AppInsights JavaScript SDK.

And here's a simple example. Suppose you would like to strip URL from reported page views. Here's how you would do it. Insert this code immediately before the last line of the snippet
<pre style="padding-left: 30px"><strong><span style="color: #000080"><span style="color: #808080">window.appInsights = appInsights;</span>
</span></strong><strong><span style="color: #000080">// Add telemetry initializer
</span></strong><strong><span style="line-height: 1.5;color: #000080">appInsights.queue.push(function () {
</span></strong><strong><span style="color: #000080">appInsights.context.addTelemetryInitializer(function (envelope) {
</span></strong><strong><span style="color: #000080">if (envelope.name === Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType)</span></strong><strong><span style="color: #000080">{
</span></strong><strong><span style="color: #000080">   envelope.data.baseData.url = "[stripped_url]";
</span></strong><strong><span style="color: #000080"> }
</span></strong><strong><span style="color: #000080">});
</span></strong><strong><span style="color: #000080">});
</span></strong><strong><span style="color: #000080">// end of insertion
</span></strong><span style="color: #808080"><strong>appInsights.trackPageView();</strong></span></pre>
&nbsp;

Another example. Suppose you would like to initialize operation ID or operation Name based on your internal logic to enable correlation working in the way specific to your application. Here's how would do it:
<pre style="padding-left: 30px"><strong><span style="color: #000080"><span style="color: #808080">window.appInsights = appInsights;</span>
</span></strong><strong><span style="color: #000080">// Add telemetry initializer
</span></strong><strong><span style="color: #000080">appInsights.queue.push(function () {
</span></strong><strong><span style="color: #000080">appInsights.context.addTelemetryInitializer(function (envelope) {
</span></strong><strong><span style="color: #000080">envelope.tags["ai.operation.id"] = "my-op-id";
</span></strong><strong><span style="color: #000080">envelope.tags["ai.operation.name"] = "my-op-name";
</span></strong><strong><span style="color: #000080"> });
</span></strong><strong><span style="color: #000080">});
</span></strong><strong><span style="color: #000080">// end of insertion
</span></strong><span style="color: #808080"><strong>appInsights.trackPageView();</strong></span></pre>
To explore the properties that you can change I suggest creating an initializer and then putting a breakpoint in your browser tools to see what properties are present on the tags object and properties that are present on the telemetry item for a particular telemetry type.
<h2>Filtering data</h2>
To use telemetry initializer in JavaScript SDK for filtering, simply return false from the function. For example, here's how I can disable all Client Performance events
<pre style="padding-left: 30px"><strong><span style="color: #000080"><span style="color: #808080">window.appInsights = appInsights;</span>
</span></strong><strong><span style="color: #000080">// Add telemetry initializer
</span></strong><strong><span style="line-height: 1.5;color: #000080">appInsights.queue.push(function () {
</span></strong><strong><span style="color: #000080">appInsights.context.addTelemetryInitializer(function (envelope) {
</span></strong><strong><span style="color: #000080">if (envelope.name === Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType)</span></strong><strong><span style="color: #000080">{
</span></strong><strong><span style="color: #000080">   return false;
</span></strong><strong><span style="color: #000080"> }
</span></strong><strong><span style="color: #000080">});
</span></strong><strong><span style="color: #000080">});
</span></strong><strong><span style="color: #000080">// end of insertion
</span></strong><span style="color: #808080"><strong>appInsights.trackPageView();</strong></span></pre>
&nbsp;

<span style="color: #000080">You can also add your data by calling <em>appInsights.trackX</em> from inside the initializer, however obviously you need to be careful with potential stack overflow.
Do you have other examples of how you're using telemetry initializers for AppInsights JavaScript SDK? Please share your feedback!</span>

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Application Insights Telemetry Stream from your browser</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/application-insights-telemetry-stream-from-your-browser</link>
      <pubDate>Sun, 03 Apr 2016 02:04:38 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/?p=201</guid>
      <description><![CDATA[I just published the first version of Application Insights Telemetry Stream - it lets you view...]]></description>
      <content:encoded><![CDATA[I just <a title="ApplicationInsights.Stream" href="https://www.nuget.org/packages/ApplicationInsights.Stream/" target="_blank">published </a>the first version of <a title="GitHub: Application Insights Telemetry Stream" href="https://github.com/AlexBulankou/ai-stream" target="_blank">Application Insights Telemetry Stream</a> - it lets you view telemetry items from the browser as they are issued by Application Insights. This is helpful in situations when you need to see what is happening with your application right this very second and cannot get to Azure portal or when telemetry indexing by Application Insights pipeline is delayed. Essentially this add-on lets you view the same data you see in your Visual Studio debug output window, except from production.
<h2>Step 1. Install Application Insights</h2>
This assumes you already installed Application Insights, if you haven't please follow the steps <a href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-start-monitoring-app-health-usage/" target="_blank">here</a>.
<h2>Step 2. Install ApplicationInsights.Stream Nuget</h2>
Make sure to check Pre-release option and search for ApplicationInsights.Stream in Visual Studio Nuget package manager or use "Install-Package ApplicationInsights.Stream -Pre" from Nuget Package Manager Console

[caption id="" align="aligncenter" width="998"]<img class="" src="https://a7bp7q.dm2303.df.livefilestore.com/y3metpSHjpyFsSCkHpa6BKMLkmISoRDkXkMScvNpd39-EFJ3qT0y5hXeDCvlM_NdoOhDan6OIhtGNwWBV7zGJXamEHKNPUl0sm7PPqn5L6JEdu9yFferrgKX0EHArCMj1FGdoZlduJp-WTfO1-zT2Qw2w?width=998&amp;height=468&amp;cropmode=none" alt="Install ApplicationInsights.Stream using NuGet Package Manager" width="998" height="468" /> Install ApplicationInsights.Stream using NuGet Package Manager[/caption]
<h2>Step 3. Update aistream:key property in web.config</h2>
Open web.config and change aistream:key setting to a custom value (it is set to 'test' by default). You may also consider changing path value to a custom path.

[caption id="" align="aligncenter" width="823"]<img class="" src="https://0eeosw.dm2303.df.livefilestore.com/y3maNM0_Kjyb_hEI42aQJS4Afp-n3547YokcRCo6ZbLZ_gx17q0uMHcyF9agUy95AYPtxJKGh0lCpZzY8r8_SBjDAg7SitaiANPdVSrRPKC32PvciPAF3m2V6v4-ZxFSlP5HeDKgIZT3iXFfiNcwqPHkw?width=823&amp;height=287&amp;cropmode=none" alt="" width="823" height="287" /> Don't forget to update aistream:key and optionally aistream:path, so it is not available to everyone visiting your site.[/caption]
<h2>Step 4. Verify and deploy</h2>
Test it locally before deploying to production. Run the application locally and open the page specified is path (default is /aistream.html. You will see a page with a textbox, enter your key into textbox and press Start.

[caption id="" align="aligncenter" width="1024"]<img class="" src="https://nc2aqa.dm2303.df.livefilestore.com/y3msNCuz8nwkxxQ5kEZgtuJOHW7titQhuBuM5ewOHGLcTqSuKkvXoMoEnhpZBJUwfJr_TMODgYkZg7iZ7ivYxvZeUAu8FyuGAEEhYqkQWmytug11nczV0V9bMo7rLDH9KEd8L7FL4IBGNJP0SZD8bMR-A?width=1024&amp;height=428&amp;cropmode=none" alt="Enter key from web.config and click Start" width="1024" height="428" /> Enter key from web.config and click Start[/caption]

Start button should disappear - you are now intercepting all telemetry. Try opening a separate browser instance and generating some load, e.g. reloading the page. On the AI Stream page should see events that you can filter by typing in the textbox:

[caption id="" align="aligncenter" width="1024"]<img class="" src="https://mljzbq.dm2303.df.livefilestore.com/y3mcKuN76admEn7LzG55ZVrjG46lLwegx5q_hAbcCGRZLSqMOX0W2M7KoB_K_7NwThjvHt3SoLfGNqQyPMVVO-On1PL7Lvob7OogbdOKS4ruhsOQZa4qVODrI1zstY7FdHNf_iJq25z_eWh1XnKyaan1Q?width=1024&amp;height=685&amp;cropmode=none" alt="AI Telemetry Stream - from your browser" width="1024" height="685" /> AI Telemetry Stream - from your browser[/caption]

That's it - you are all set to use it - please share your feedback!]]></content:encoded>
    </item>
    <item>
      <title>Application Insights JavaScript SDK extension for jQuery Mobile</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/application-insights-javascript-sdk-extension-for-jquery-mobile</link>
      <pubDate>Thu, 24 Mar 2016 17:43:50 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/?p=182</guid>
      <description><![CDATA[We have a fair number of customers asking about Single Page Application support in Application...]]></description>
      <content:encoded><![CDATA[We have a fair number of customers asking about Single Page Application support in Application Insights JavaScript SDK. However since there are so many popular SPA JavaScript frameworks (jQueryMobile, Angular, ReactJS to just name the most popular few), and all of them implement custom routing logic, it is difficult to find a common ground. So out of the box views are only logged with physical page loads and main telemetry "buckets" (or "operations" in Application Insights speak) are associated with physical pages. However for any given framework it is very easy to add custom support to ensure that virtual pages or routes are treated and pages and telemetry logged within their context is associated correctly. This is my attempt at that with

<strong> <a href="https://github.com/AlexBulankou/ai-jqm">Application Insights JavaScript SDK extension for jQuery Mobile</a>.</strong>

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/extension.png"><img class=" size-large wp-image-184 aligncenter" src="https://msdnshared.blob.core.windows.net/media/2016/03/extension-1024x410.png" alt="extension" width="1024" height="410" /></a>

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Application Map - adding to startboard from part gallery</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/application-map-adding-to-startboard-from-part-gallery</link>
      <pubDate>Wed, 16 Mar 2016 13:06:44 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/?p=163</guid>
      <description><![CDATA[In my previous post I described Application Map in Application Insights that lets you view the...]]></description>
      <content:encoded><![CDATA[In my <a href="https://blogs.msdn.microsoft.com/albulank/2016/03/08/application-map-topology-of-your-application-in-appinsights/" target="_blank">previous post</a> I described Application Map in Application Insights that lets you view the topology of your application, including dependencies (outgoing requests) and incoming requests in a glance. In this post I wanted to demonstrate how easy it is to add Application Map to your Azure portal startboard from Part Gallery. The following animation demonstrates how:
<ol>
	<li>Click edit on top of startboard</li>
	<li>Bring up tile gallery</li>
	<li>Order resources by type</li>
	<li>Select Application Insights</li>
	<li>Select your Application Insights resource</li>
	<li>Scroll all the way down to find Application Map</li>
	<li>Drag it your starboard</li>
	<li>Click Done to finish editing startboard</li>
</ol>
&nbsp;

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/map_from_gal.gif"><img class=" wp-image-172  aligncenter" src="https://msdnshared.blob.core.windows.net/media/2016/03/map_from_gal.gif" alt="map_from_gal" width="900" height="727" /></a>

That's it! Please share your feedback!

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Application Map - topology of your application in AppInsights</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/application-map-topology-of-your-application-in-appinsights</link>
      <pubDate>Tue, 08 Mar 2016 14:16:55 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/?p=123</guid>
      <description><![CDATA[If you've been one of 10% of customers who have this experience enabled (very soon this will be...]]></description>
      <content:encoded><![CDATA[If you've been one of 10% of customers who have this experience enabled (very soon this will be expanded to all customers) you might have noticed this new Application Map page. You can actually force yourself into this experience by using the following URL:

<a title="https://portal.azure.com/?appInsightsExtension_OverrideSettings=applicationmap:true" href="https://portal.azure.com/?appInsightsExtension_OverrideSettings=applicationmap:true" target="_blank"><strong>https://portal.azure.com/?appInsightsExtension_OverrideSettings=applicationmap:true</strong></a>

(if you notice that query string parameter disappears after you login, you might need to append it again and refresh the page).

To get to Application Map page, click this item in the settings list - and you will see it in all its glory!

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/am4.jpg"><img class="  wp-image-151 aligncenter" src="https://msdnshared.blob.core.windows.net/media/2016/03/am4.jpg" alt="am4" width="1000" height="326" /></a>

&nbsp;

This is how Application Map looks for my website -

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/am3.jpg"><img class="  wp-image-142 aligncenter" src="https://msdnshared.blob.core.windows.net/media/2016/03/am3.jpg" alt="am3" width="886" height="644" /></a>

What we are showing on the Application Map is what you application depends on - other components and services that it is making calls to.

For each of the dependency types it is showing average duration and health stats. For example you can see that my application is making HTTP calls, SQL calls and NPGSQL calls (this is a custom dependency that I am logging manually by using TrackDependency() API). If you would like to learn more about dependencies in Application Insights, <a href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-dependencies/" target="_blank">this is a great place to start</a>:

For a new unconfigured application, Application Map looks like this.

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/am5.jpg"><img class="  wp-image-161 aligncenter" src="https://msdnshared.blob.core.windows.net/media/2016/03/am5.jpg" alt="am5" width="1010" height="632" /></a>

If we detect that your Application Insights resource is linked to a Web App in Azure portal (typical scenario for this is when Application Insights resource was auto-created when created a website), we allow you to enable Application Insights for your web application automatically - just click on "Monitor server and dependencies" button. This is the equivalent to enabling it by adding Application Insights extension from WebApp blade, but, as we a hoping, more discoverable.

What I described was the very first iteration of Application Map experience - we'll continue making updates to it every week.  Looking forward to your feedback!

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Finding Telemetremo - steps to diagnose why your data is not showing in AppInsights</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/finding-telemetremo-steps-to-diagnose-why-your-data-is-not-showing-in-appinsights</link>
      <pubDate>Wed, 27 Jan 2016 12:54:00 GMT</pubDate>
      <dc:creator><![CDATA[Alex Bulankou]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/2016/01/27/finding-telemetremo-steps-to-diagnose-why-your-data-is-not-showing-in-appinsights/</guid>
      <description><![CDATA[The steps in this blog entry is pretty much how a significant part of my daily life is spent these...]]></description>
      <content:encoded><![CDATA[<span style="font-family: 'trebuchet ms', geneva;font-size: small">The steps in this blog entry is pretty much how a significant part of my daily life is spent these days and most of it is actually not for customers' application, but for the ones we write ourselves. Hey, where's that telemetry item I just sent? No, I sent it really, let me show you a Fiddler trace... Hmm.. or did I?</span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Decision Tree</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">When you see no data you can use this handy decision tree to know what things to try:</span>

<span style="font-family: 'trebuchet ms', geneva"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/5037.WhereIsMyData_with_pics.jpg"><img class=" aligncenter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/5037.WhereIsMyData_with_pics.jpg" alt="" width="636" height="901" border="0" /></a></span>

&nbsp;

<span style="font-family: 'trebuchet ms', geneva;font-size: small">Now I will try to explain some of the nodes of this tree.</span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Are you seeing no data at all or just specific data types missing?</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">This is the first thing we ask the customers - let's identify if you are seeing no data at all just some types.</span>

<span style="font-family: 'trebuchet ms', geneva;font-size: small">The best place to check is using search on the portal. Search is showing what we call "raw data".  Please note that aggregated data can be missing because there is about 5 minutes delay before it arrives. However telemetry items can be found in search very shortly after they are sent in most cases:</span>

<span style="font-family: 'trebuchet ms', geneva"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/0207.bDzEB.png"><img class=" aligncenter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/0207.bDzEB.png" alt="" width="902" height="625" border="0" /></a></span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">What telemetry types should I expect (and not expect) to see?</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">Here's a brief overview:</span>
<ul>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small"><strong>Requests</strong>: You should expect requests if you onboarded to <a title="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net/" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net/" target="_blank">Web SDK for ASP.NET </a>or ASP.NET v5 SDK.</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small"><strong>PageViews/ClientPerformance</strong>: To get PageViews and ClientPerformance you need to <a title="https://azure.microsoft.com/en-us/documentation/articles/app-insights-javascript" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-javascript" target="_blank">onboard to our JavaScript SDK</a> by inserting a snippet into your master page.</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small"><strong>Exceptions</strong>: You can get unhandled <a title="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net-exceptions/" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net-exceptions/" target="_blank">exceptions automatically collected</a> by Web SDK and JavaScript SDK is <a title="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net-exceptions/#browser-exceptions" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net-exceptions/#browser-exceptions" target="_blank">automatically collecting script errors</a></span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Check our documentation for more information on <a title="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net-dependencies" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net-dependencies">dependencies</a>, <a title="https://azure.microsoft.com/en-us/documentation/articles/app-insights-web-monitor-performance/#system-performance-counters" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-web-monitor-performance/#system-performance-counters" target="_blank">performance counters</a>, <a title="https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-custom-events-metrics/" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-custom-events-metrics/" target="_blank">events and metric</a>s, and <a title="traces" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-search-diagnostic-logs/">traces</a>.</span></li>
</ul>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">What if I don't see ANY telemetry?</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">Can you reproduce the issue locally? That is, can you do F5 in Visual Studio or at least login to the machine where web app is running to do diagnostics? If you can, then we are good - we will most likely be able to diagnose and understand what's going wrong. </span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Check telemetry items in VS debug output window</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">If you can run your application under debugger the first step to check what telemetry is being sent in VS debug output window:</span>

<span style="font-family: 'trebuchet ms', geneva"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/8304.Capture_20160127-2.PNG"><img class=" aligncenter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/8304.Capture_20160127-2.PNG" alt="" width="903" height="281" border="0" /></a></span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Check Application Insights references and configuration</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">If you don't see any telemetry in VS debug ouput window, chances are you haven't properly referenced AI assemblies or web.config entries are missing or ApplicationInsights.config has incorrect entries. At the time of this writing latest stable Web SDK (version 1.2.3) and its dependencies would include the following assemblies:</span>
<ul>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Microsoft.ApplicationInsights</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Microsoft.AI.Web</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Microsoft.AI.WindowsServer</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Microsoft.AI.ServerTelemetryChannel</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Microsoft.AI.PerfCounterCollector</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Microsoft.AI.DependencyCollector</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Microsoft.AI.Agent.Intercept.</span></li>
</ul>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">In web.config, there should be an entry for ApplicationInsightsWebTracking HTTP module. And finally ApplicationInsights.config should be present with instrumentation key specified, unless you are <a title="specifying instrumentation key programmatically" href="https://apmtips.com/blog/2014/11/17/programmatically-set-instrumentation-key/">specifying instrumentation key programmatically</a>. To enable client-side telemetry there should be Application Insights JavaScript SDK snippet in your master page, for example in Layout.cshtml for MVC applications</span>

<span style="font-family: 'trebuchet ms', geneva"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/6886.config_issues2.jpg"><img class=" aligncenter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/6886.config_issues2.jpg" alt="" width="902" height="429" border="0" /></a></span>

<span style="font-family: 'trebuchet ms', geneva;font-size: small">A few times I saw the problem with ApplicationInsights.config which contained some entries from the old SDK after it was updated. The easiest way to verify is to create a new web application and compare the configs line by line using a diff tool.</span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Check with Fiddler that telemetry is sent successfully</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">Fiddler is super useful for this kind of investigations. Look for requests sent to Application Insights data collection endpoint (dc.services.visualstudio.com). Client side telemetry will be sent from your browser process. Checking server side telemetry can be a bit more tricky. First you need to have your application run under IIS process (enabling it for IIS express is <a title="even more complex" href="https://stackoverflow.com/questions/4706468/using-fiddler-with-iis7-express" target="_blank">even more complex</a>). Then you should either change IIS application pool to run under your name or add proxy instructions to web.config. Either approach should do the trick, but somehow I often found myself doing both.</span>

<span style="font-family: 'trebuchet ms', geneva"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/5582.installing_fiddler.jpg"><img class=" aligncenter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/5582.installing_fiddler.jpg" alt="" width="902" height="569" border="0" /></a></span>

<span style="font-family: 'trebuchet ms', geneva;font-size: small">Once you get Fiddler working you can verify what you are sending from both client and server and also check the response back from data collection endpoint.</span>

<span style="font-family: 'trebuchet ms', geneva"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/2577.fiddler_trace.jpg"><img class=" aligncenter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/81/69/2577.fiddler_trace.jpg" alt="" width="900" height="447" border="0" /></a></span>

&nbsp;
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Check ETW traces</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small"> Here's an <a title="ETW traces collection for Application Insights" href="https://sergeysharp.com/blog/2015/04/16/diagnostic-of-applicationinsights-sdk/">excellent blog post by Anastasia Baranchenkova</a> on how to enable ETW tracing for Application Insights.</span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Check latency issues with Application Insights backend</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">When there's a prolonged outage we post it in <a title="Application Insights outages" href="https://blogs.msdn.com/b/applicationinsights-status/">this blog</a>. Please check if there are any ongoing incidents.</span>
<h3><span style="font-size: medium;font-family: 'trebuchet ms', geneva">Contact us!</span></h3>
<span style="font-family: 'trebuchet ms', geneva;font-size: small">If you're stuck, please let us know and we'll try to help. There are numerous ways you can reach us. And by the way, responding to forums is one of our weekly on-call engineer responsibilities, so in the priority list it is just below service incidents, which means if we are not getting back to you quickly, there's a likely a service incident :) Well, not always, but quite often.</span>
<ul>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small"><a title="Stack Overflow" href="https://stackoverflow.com/questions/tagged/ms-application-insights" target="_blank">Stack Overflow</a> - use tag ms-application-insights</span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small"><a title="MSDN forums" href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=ApplicationInsights">MSDN Forums</a></span></li>
	<li><span style="font-family: 'trebuchet ms', geneva;font-size: small">Use Disqus to post a clarifying questions to our <a title="documention" href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-overview/">documentation</a></span></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Windows Phone 7 Developer Tools CTP - simple app and first impressions</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/windows-phone-7-developer-tools-ctp-simple-app-and-first-impressions</link>
      <pubDate>Thu, 08 Apr 2010 19:25:00 GMT</pubDate>
      <dc:creator><![CDATA[albulank]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/2010/04/08/windows-phone-7-developer-tools-ctp-simple-app-and-first-impressions/</guid>
      <description><![CDATA[Very pleasant XAML editing/design experience, unbearable deployment wait time.
Creating the...]]></description>
      <content:encoded><![CDATA[<P><B>Very pleasant XAML editing/design experience, unbearable deployment wait time.</B></P>
<P>Creating the project, opening the designer and adding/changing a few lines - initial impression was definitely positive - the XAML designer updates immediately, IntelliSense is working as expected. I even tried dragging something from the toolbox (something I haven't in a while with WPF, knowing it's often safer and always faster to just type it in) and it 'just worked'. </P>
<P><IMG style="WIDTH: 600px; HEIGHT: 396px" title="VS 2010 Express for Windows Phone CTP" alt="VS 2010 Express for Windows Phone CTP" align=middle src="https://ipqrxq.bay.livefilestore.com/y1pCy26rpt0eglHZDWhbs9XlMHo27YZIAWj5faMb-y8PglNmzbEzT61V0838rwlItjPMZYic2tC_N8Zp8HCe6e-BoXtZ_negyU3/IDE.png" width=600 height=396 mce_src="https://ipqrxq.bay.livefilestore.com/y1pCy26rpt0eglHZDWhbs9XlMHo27YZIAWj5faMb-y8PglNmzbEzT61V0838rwlItjPMZYic2tC_N8Zp8HCe6e-BoXtZ_negyU3/IDE.png"></P>
<P>Well, unfortunately, despite having been impressed with IDE experience and designer responsiveness, eventually I ended up writing my&nbsp; and testing application as a regular Silverlight project&nbsp;on different machine/VS instance&nbsp;and then moving it over to the VS 2010 Express for Windows Phone 7 and changing a few things. Reason being the deployment and connecting to emulator would literally take 3-5 minutes,&nbsp;so I would hit Ctrl+F5 and sit there waiting (or more likely switch to something else and forget what I was about to do). Luckily after my app worked on regular Silverlight, there was very little I had to change. </P>
<P><BR><B>Edit App.xaml to change default styles.</B></P>
<P>I had to change default font size for my app, and found that the default styles and brushes, such as PhoneForegroundBrush and PhoneBackgroundBrush are in App.xaml.</P><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas></FONT></FONT></FONT>
<P><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>&lt;</FONT></FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>system</FONT></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>:</FONT></FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>Double</FONT></FONT></FONT><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas> x</FONT></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>:</FONT></FONT></FONT><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas><FONT color=#ff0000 size=2 face=Consolas>Key</FONT></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>="PhoneFontSizeNormal"&gt;</FONT></FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>26</FONT></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>&lt;/</FONT></FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>system</FONT></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>:</FONT></FONT></FONT><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas><FONT color=#a31515 size=2 face=Consolas>Double</FONT></FONT></FONT><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>&gt;</FONT></FONT></FONT></P><STRONG>The App</STRONG> 
<P>My app uses Purdy Points algorithm (that I borrowed from <A title=here href="https://www.cs.uml.edu/~phoffman/xcinfo3.html" target=_blank mce_href="https://www.cs.uml.edu/~phoffman/xcinfo3.html">here</A>) to predict race pace, based on past running performance.&nbsp; BTW, If you are runner and/or would like to know more about Purdy Points, here's the <A title=website href="https://run-down.com/statistics/calcs_explained.php" target=_blank mce_href="https://run-down.com/statistics/calcs_explained.php">website</A>, it also has a proper calculator that provides more data. </P>
<P>On an emulator my app looked like this:</P>
<P mce_keep="true"><IMG style="WIDTH: 307px; HEIGHT: 600px" title="Purdy Points Calculator on Windows Phone 7 Emulator" alt="Purdy Points Calculator on Windows Phone 7 Emulator" align=middle src="https://ipqrxq.bay.livefilestore.com/y1pWvxBjTD4eLW457Umz1J0gikzfEgWyPxUSoHFWpMPLaybw8DbU5UuSU3aOV5jAPy04MaEd_si0J6X0M1DHRqS_CWSSMW3Jdd-/app.png" width=307 height=600 mce_src="https://ipqrxq.bay.livefilestore.com/y1pWvxBjTD4eLW457Umz1J0gikzfEgWyPxUSoHFWpMPLaybw8DbU5UuSU3aOV5jAPy04MaEd_si0J6X0M1DHRqS_CWSSMW3Jdd-/app.png"></P>
<P><B>TextBox.InputScope</B></P>
<P>For my time input text boxes I wanted the number keypad appear when they get focus. </P>
<P>&nbsp;<IMG style="WIDTH: 381px; HEIGHT: 391px" title="numeric keypad" alt="numeric keypad" align=middle src="https://ipqrxq.bay.livefilestore.com/y1pX_quKZrjudKRYyRvSxsdxpDn5zumVei6fuK41-79K3brgtkJ-XVwRavegKUz2HeT4SwFPWPaA6XYRrdOJaqIdxI72vh4HiVz/numkeypad.png" width=381 height=391 mce_src="https://ipqrxq.bay.livefilestore.com/y1pX_quKZrjudKRYyRvSxsdxpDn5zumVei6fuK41-79K3brgtkJ-XVwRavegKUz2HeT4SwFPWPaA6XYRrdOJaqIdxI72vh4HiVz/numkeypad.png"></P>
<P>Then I came across this <A title="forum topic" href="https://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/010676ee-88ad-4e95-a9f5-3ea38578abea" target=_blank mce_href="https://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/010676ee-88ad-4e95-a9f5-3ea38578abea">forum topic</A>. InputScope property determines the context for the input. Actually I also expected it to restrict the input to whatever context it is set, i.e. in my case I would have liked it to restrict input to numeric characters. However it is not part of InputScope functionality, so I had to implement filtering myself. At first I tried to set InputScope as part of style for my TextBox:</P><FONT size=2 face=Consolas>
<P mce_keep="true"><BR>....</P>
<P mce_keep="true">&lt;Setter Property="InputScope" Value="Number"/&gt;<BR><LT;SETTER><BR property="InputScope" value="Number" &gt;="">....<BR></LT;SETTER></P></FONT>
<P mce_keep="true">but it would crash inside InitializeComponent() with a parsing exception missing any additional information. It works though when it is not part of style definition. Anyway, in my case I set it in code, because I subclassed the TextBox to implement custom focus and filtering behavior.</P>
<P mce_keep="true"><FONT size=2 face=Consolas><FONT size=2 face=Consolas>InputScope = new InputScope();<BR>InputScope.Names.Add(new InputScopeName() { NameValue = InputScopeNameValue.Number});</FONT></FONT></P>
<P mce_keep="true"><B>Microsoft.Phone.Controls.ListView</B></P>
<P mce_keep="true">Initially I used ListBox to display the results and then noticed that there's a new ListView control in Microsoft.Phone.Controls.dll. ListView inherits from ListBox (same as in WPF) so I in theory all I had to do was to change my tags in xaml from ListBox/ListBoxItem to ListView/ListViewItem. But when I attempted to bind the control to the collection, it failed to render leaving me with the following mysterious output.</P>
<P mce_keep="true"><IMG style="WIDTH: 461px; HEIGHT: 378px" title="ListView error" alt="ListView error" align=middle src="https://ipqrxq.bay.livefilestore.com/y1pxq8dK41CzYAWI6wsUsdTx5_pjQbgOwSjduDe2HeAUppcKfWiozPkhoLBUOsEIeeorVo4btLoo3mxrhAImCJHboNVNY_TdTfx/ListViewError.pngd=8169&amp;postid=9993012" width=461 height=378 mce_src="https://ipqrxq.bay.livefilestore.com/y1pxq8dK41CzYAWI6wsUsdTx5_pjQbgOwSjduDe2HeAUppcKfWiozPkhoLBUOsEIeeorVo4btLoo3mxrhAImCJHboNVNY_TdTfx/ListViewError.pngd=8169&amp;postid=9993012"><BR></P>
<P mce_keep="true">For now I switched it back to using ListBox, but I'll look into this later and will post update to this blog&nbsp;when I&nbsp;find the issue.</P>
<P mce_keep="true"><B>Zipped SLN,&nbsp;references and acknowledgments</B>&nbsp;</P>
<OL>
<LI>
<DIV mce_keep="true">Complete zipped solution: <A href="https://bit.ly/98DhVr" target=_blank mce_href="https://bit.ly/98DhVr">https://bit.ly/98DhVr</A>&nbsp;</DIV></LI>
<LI>
<DIV mce_keep="true">Windows Phone 7 Developer Tools CTP download page: <A href="https://www.microsoft.com/downloads/details.aspx?FamilyId=2338b5d1-79d8-46af-b828-380b0f854203&amp;displaylang=en">https://www.microsoft.com/downloads/details.aspx?FamilyId=2338b5d1-79d8-46af-b828-380b0f854203&amp;displaylang=en</A></DIV></LI>
<LI>
<DIV mce_keep="true">Purdy calculator algorithm: <A href="https://www.cs.uml.edu/~phoffman/xcinfo3.html">https://www.cs.uml.edu/~phoffman/xcinfo3.html</A></DIV></LI></OL>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>How to receive a full GC notification with .NET 4.0</title>
      <link>https://docs.microsoft.com/archive/blogs/albulank/how-to-receive-a-full-gc-notification-with-net-4-0</link>
      <pubDate>Sun, 15 Nov 2009 17:53:00 GMT</pubDate>
      <dc:creator><![CDATA[albulank]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/albulank/2009/11/15/how-to-receive-a-full-gc-notification-with-net-4-0/</guid>
      <description><![CDATA[While&nbsp;scanning GC class members in IntelliSense with VS 2010 I noticed a few that looked...]]></description>
      <content:encoded><![CDATA[<P>While&nbsp;scanning GC class members in IntelliSense with <A title="VS 2010" href="https://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" target=_blank mce_href="https://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx">VS 2010</A> I noticed a few that looked unfamiliar. Turns out new feature allows receiving full GC notifications using the following methods:</P><FONT size=2 face=Consolas>
<UL>
<LI>GC.RegisterForFullGCNotification(..)</LI>
<LI>GC.CancelFullGCNotification(..)</LI>
<LI>GC.WaitForFullGCApproach(..)</LI>
<LI>GC.WaitForFullGCComplete(..)</LI></UL></FONT>
<P>This is how MSDN <A title=explains href="https://msdn.microsoft.com/en-us/library/cc713687.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/cc713687.aspx">explains</A> the main user scenario for these notifications:</P>
<P><EM>There are situations in which a full garbage collection by the common language runtime may adversely affect performance. This can be an issue particularly with servers that process large volumes of requests; in this case, a long garbage collection can cause a request time-out. To prevent a full collection from occurring during a critical period, you can be notified that a full garbage collection is approaching and then take action to redirect the workload to another server instance. You can also induce a collection yourself, provided that the current server instance does not need to process requests.</EM></P>
<P>I decided to try them out and wrote a test WPF app that displays a message when full GC is about to start and then another message when full GC is complete. MSDN provides a <A title="decent sample" href="https://msdn.microsoft.com/en-us/library/cc713687.aspx" mce_href="https://msdn.microsoft.com/en-us/library/cc713687.aspx">decent sample </A>that explains the usage pattern, but in a nutshell it is:</P>
<OL>
<LI>On the main thread call GC.RegisterForFullGCNotification(..)</LI>
<LI>Spawn a separate thread&nbsp; that will call WaitForFullGCApproach and then WaitForFullGCComplete. In my case I was calling these methods with infinite timeout to keep it simple, so it would either return Succeeded or Canceled. Then I would send notification to the main thread that GC is either approaching or completed. Here's how 'GC notification procedure' looked.</LI><FONT size=2 face=Consolas>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void GCNotifyProc()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (true)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var gcApproachStatus = GC.WaitForFullGCApproach(-1); <STRONG>//wait indefinitely<BR></STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (gcApproachStatus == GCNotificationStatus.Succeeded)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<STRONG>&nbsp;//notify the main thread that full GC is imminent<BR></STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dispatcher.Invoke(new Action(() =&gt; NotifyGCStart()));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG>// Main thread must have called GC.CancelFullGCNotification(..), <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // or notification failed, exit the procedure<BR></STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var gcCompleteStatus = GC.WaitForFullGCComplete(-1); <STRONG>//wait indefinitely</STRONG><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (gcCompleteStatus == GCNotificationStatus.Succeeded)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<STRONG> //notify the main thread that full GC has completed<BR></STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dispatcher.Invoke(new Action(() =&gt; NotifyGCComplete()));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<STRONG> // Main thread must have called GC.CancelFullGCNotification(..), <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // or notification failed, exit the procedure<BR></STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</P></FONT>
<LI>To stop listening for GC notifications, call GC.CancelFullGCNotification(..) from the main thread. At this point my background thread that was waiting inside WaitForFullGCApproach or WaitForFullGCComplete would return with GCNotificationStatus.Canceled and exit the procedure.</LI></OL>
<P mce_keep="true">&nbsp;</P>
<P>While this seems quite straightforward, I'd like to point out&nbsp;a few details that I learnt or realized while playing with GC notifications.</P>
<OL>
<LI>
<DIV mce_keep="true"><STRONG>Concurrent GC needs to be disabled </STRONG>to use GC notifications. To disable add the following to your config file:</DIV></LI>
<DIV mce_keep="true">&lt;configuration&gt;<BR>&nbsp;&nbsp; &lt;runtime&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;gcConcurrent enabled="false"/&gt;<BR>&nbsp;&nbsp; &lt;/runtime&gt;<BR>&lt;/configuration&gt;</DIV>
<LI>
<DIV mce_keep="true">Full GC Notifications... are <STRONG>full</STRONG> GC notifications. Well, this is sure obvious, unless you, like me, forgot or wasn't sure what 'full' really means. Full GC means GC on&nbsp;Generation 2, while ephemeral GC means GC&nbsp; on Generation 0 and 1. To recall,&nbsp;object is promoted to Gen2 after it has survided Gen1&nbsp;GC with the exception of Large Object Heap objects that are bigger than 85K bytes and become part of Gen2 right from the start. So,<STRONG> this notification mechanism&nbsp;are for Gen2 collections only.</STRONG></DIV></LI>
<LI>
<DIV mce_keep="true">And finally,&nbsp;when WaitForFullGCApproach(..) returns Succeeded, all it means is that conditions for full GC are favourable and full GC is imminent. <STRONG>No guarantees are made about when exactly&nbsp;it will run.</STRONG> The name of the method reflects it clear enough, although I would probably make it sound even less deterministic.</DIV></LI></OL>
<P mce_keep="true">My post was just scratching the surface, but&nbsp;if you're looking&nbsp;for more in-depth info on GC notifications,&nbsp;I'd&nbsp;recommend the following blog: &nbsp;<A href="https://blogs.msdn.com/maoni/archive/2008/11/19/so-what-s-new-in-the-clr-4-0-gc.aspx">https://blogs.msdn.com/maoni/archive/2008/11/19/so-what-s-new-in-the-clr-4-0-gc.aspx</A></P>]]></content:encoded>
    </item>
  </channel>
</rss>