<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Oren Nachman</title>
	
	<link>http://www.nachmore.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 25 Aug 2010 01:55:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/OrenNachman" /><feedburner:info uri="orennachman" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>WP7 Perf Tip #2: Know your ProgressBar</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/Wvf9fUJ9BFM/</link>
		<comments>http://www.nachmore.com/2010/wp7-perf-tip-2-know-your-progressbar/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 01:48:08 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Perf Tips]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=162</guid>
		<description><![CDATA[Take Away&#8217;s:

Do not use the built in ProgressBar straight up, use Jeff&#8217;s template 
When you&#8217;re done with an indeterminate ProgressBar, make sure to toggle IsIndeterminate to False and Collapse the bar
General: Always make sure to stop animations / remove animating controls when they&#8217;re no longer needed

Some Background:
Due to a bunch of different reasons the shipping ProgressBar [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Take Away&#8217;s:</strong></p>
<ol>
<li>Do not use the built in ProgressBar straight up, use <a href="http://www.jeff.wilcox.name/2010/08/performanceprogressbar/">Jeff&#8217;s template </a></li>
<li>When you&#8217;re done with an indeterminate ProgressBar, make sure to toggle IsIndeterminate to False and Collapse the bar</li>
<li>General: Always make sure to stop animations / remove animating controls when they&#8217;re no longer needed</li>
</ol>
<p><strong>Some Background:</strong></p>
<p>Due to a bunch of different reasons the shipping ProgressBar control is suboptimal and will actually be UI thread bound &#8211; meaning that if your UI thread is stuck working, your ProgressBar will be stuck as well. Not a great situation for a ProgressBar, huh?</p>
<p>That said, we&#8217;re not leaving you high and dry. <a href="http://www.jeff.wilcox.name/">Jeff Wilcox</a> has <a href="http://www.jeff.wilcox.name/2010/08/performanceprogressbar/">a great solution</a> which changes the template for the ProgressBar to only run on the Render thread &#8211; meaning that it will continue ticking, even when you&#8217;re doing your heavy loading work on the UI thread. That said, it still comes with a gotcha &#8211; don&#8217;t forget to set IsIndeterminate to False and to Collapse the bar once your done (instead of just setting Visibility to Hidden) so that the ProgressBar doesn&#8217;t continue to tick in the background, eating up Render thread cycles.</p>
<p>As a general rule, highlighted especially by the ProgressBar, you should always make sure to stop animations (not pause) and remove / collapse animating controls when they&#8217;re no longer needed.</p>
<p><strong>Remember:</strong> just because you can&#8217;t see a animation / control doesn&#8217;t mean that it isn&#8217;t there doing work.</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/Wvf9fUJ9BFM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/wp7-perf-tip-2-know-your-progressbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/wp7-perf-tip-2-know-your-progressbar/</feedburner:origLink></item>
		<item>
		<title>WP7 Perf Tip #1: Test on Device</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/VmleutTaY7U/</link>
		<comments>http://www.nachmore.com/2010/wp7-perf-tip-1-test-on-device/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 01:44:08 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Perf Tips]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=159</guid>
		<description><![CDATA[I&#8217;m kicking off a series of posts about Silverlight perfofmance under Windows Phone 7 with a a kind of obvious one, but one that is important to keep in mind from the get go.
Tip:

Test your code on device as much as possible

But the Emulator is awesome?!?
True, the emulator, otherwise known as the x86 Device Emulator, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m kicking off a series of posts about Silverlight perfofmance under Windows Phone 7 with a a kind of obvious one, but one that is important to keep in mind from the get go.</p>
<p><strong>Tip:</strong></p>
<ul>
<li>Test your code on device as much as possible</li>
</ul>
<p><strong>But the Emulator is awesome?!?</strong></p>
<p>True, the emulator, otherwise known as the x86 Device Emulator, or simply XDE, is awesome, but it is still not an accurate representation of a device. In fact since the XDE is usually so smooth, it&#8217;s extremely easy to fall into the trap of adding more features &#8220;because it works on the emulator&#8221;.</p>
<p><strong>The Hardware</strong></p>
<p>The emulator restricts itself to one core, adds artificial Sleep()&#8217;s and limits the amount of memory it is happy to eat up (so it won&#8217;t just chew through whatever is available), but that still isn&#8217;t enough.Chances are that even running at one core the emulator is still running faster than the device (most cores today are going to be running faster than 1GHz and chances are you are going to have less things running on that core than the device does). Throw in a desktop GPU which beat a mobile GPU handsdown and you&#8217;ve got a winning combination. If you happen to have an older machine, then the XDE will simply run like a dog &#8211; and you won&#8217;t be able to tell if your app crawls because of your code or because of your machine.</p>
<p><strong>But I don&#8217;t have a device!</strong></p>
<p>Common problem, especially in these trying, pre-release, times. Fear not though! Your local Microsoft office most likely has some devices and can help hook you up. Shoot them an email and let them know that you are working on an app, include a description and some screenshots from the XDE (to sweeten the deal) and they should be able to help.</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/VmleutTaY7U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/wp7-perf-tip-1-test-on-device/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/wp7-perf-tip-1-test-on-device/</feedburner:origLink></item>
		<item>
		<title>WP7 Silverlight TextBoxes No Longer Scroll</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/jVwW_CdNq7c/</link>
		<comments>http://www.nachmore.com/2010/wp7-silverlight-textboxes-no-longer-scroll/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 20:57:38 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=152</guid>
		<description><![CDATA[There&#8217;s a change in the pipeline that will be hitting the public Windows Phone 7 images at some point soon (post the current Beta), which removes the ScrollViewer from a TextBox&#8217;s template.
What does this mean?
Basically, long TextBoxes will no longer scroll when you gesture over them &#8211; the gesture is ignored and there is no [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a change in the pipeline that will be hitting the public Windows Phone 7 images at some point soon (post the current Beta), which removes the ScrollViewer from a TextBox&#8217;s template.</p>
<p><strong>What does this mean?</strong></p>
<p>Basically, long TextBoxes will no longer scroll when you gesture over them &#8211; the gesture is ignored and there is no visual reaction. Tapping remains the same (the keyboard pops up) as does tapping and holding (the enlarged caret is shown, and you can use this to, sort of, scroll).</p>
<p><strong>How do I work around this?</strong></p>
<p>Most scenarios do not require scrollable TextBoxes, but if your&#8217;s does you can either place the TextBox inside a ScrollViewer (though this can cause some texture issues), or preferably re-add the ScrollViewer into your TextBoxes template, so that it still scrolls as usual.</p>
<p><a href="http://blogs.msdn.com/b/oren/archive/2010/08/09/wp7-silverlight-texboxes-no-longer-scroll.aspx">Original Post</a></p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/jVwW_CdNq7c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/wp7-silverlight-textboxes-no-longer-scroll/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/wp7-silverlight-textboxes-no-longer-scroll/</feedburner:origLink></item>
		<item>
		<title>BUG: Silverlight Crashes (Along With the Browser) When Profiled</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/bJnryijyvqQ/</link>
		<comments>http://www.nachmore.com/2010/bug-silverlight-crashes-along-with-the-browser-when-profiled/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 02:13:27 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=148</guid>
		<description><![CDATA[It&#8217;s one of those bugs&#8230; If you&#8217;ve tried profiling Silverlight lately and you&#8217;ve run into a consistent crash in Silverlight which brings down the browser, but only on specific projects then this bug is for you.
Basically, profiling any Silverlight app (plugin or OOB) that takes advantage of Shaders will cause Silverlight (and its container) to crash. [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s one of those bugs&#8230; If you&#8217;ve tried profiling Silverlight lately and you&#8217;ve run into a consistent crash in Silverlight which brings down the browser, but only on specific projects then this bug is for you.</p>
<p>Basically, profiling any Silverlight app (plugin or OOB) that takes advantage of <a href="http://msdn.microsoft.com/en-us/library/dd901594.aspx">Shaders</a> will cause Silverlight (and its container) to crash. The only current workaround is to remove the shaders before profiling (possibly with an #ifdef if you are so inclined). This is slated to be fixed in an upcoming version of SL 4 (though no release dates yet).</p>
<p><strong>Note:</strong> people often get scared of crashes since they can indicate a security bug &#8211; but this <strong>is not</strong> a security issue (the profiler puts us into a bad state, causing the crash).</p>
<p>Cross-posted from <a href="http://blogs.msdn.com/b/oren/archive/2010/08/06/bug-silverlight-crashes-along-with-the-browser-when-profiled.aspx">msdn</a>.</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/bJnryijyvqQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/bug-silverlight-crashes-along-with-the-browser-when-profiled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/bug-silverlight-crashes-along-with-the-browser-when-profiled/</feedburner:origLink></item>
		<item>
		<title>Debugging Silverlight in Firefox 3.6.4 (and newer)</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/MaPgJQS9kUo/</link>
		<comments>http://www.nachmore.com/2010/debugging-silverlight-in-firefox-3-6-4-and-newer/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 00:41:36 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=145</guid>
		<description><![CDATA[While they chug along to Firefox 4, Mozilla just released Firefox 3.6.4 (and quickly followed up with 3.6.6) on the world, sporting a new feature &#8211; plugin isolation. By isolating plugins to a different process, Firefox catches up to Chrome in stability, by ensuring that a rogue plugin that crashes does not bring down the [...]]]></description>
			<content:encoded><![CDATA[<p>While they chug along to Firefox 4, Mozilla just released Firefox 3.6.4 (and quickly followed up with 3.6.6) on the world, sporting a new feature &#8211; plugin isolation. By isolating plugins to a different process, Firefox catches up to Chrome in stability, by ensuring that a rogue plugin that crashes does not bring down the whole browser, instead you get the sad face informing you that something has happened. This is a great end-user feature which will increase the general reliability of a user&#8217;s browsing experience &#8211; but we aren&#8217;t just users, are we?</p>
<p>Firefox will shut down a plugin when it is deemed to be either dead, or frozen. Unfortunately frozen is the state that the plugin will enter when you try to debug it (say, through Visual Studio), causing Firefox to kill the plugin and continue on its merry way. There have a been a number of proposed solutions, mainly around disabling the plugin container for Silverlight (see <a href="http://forums.silverlight.net/forums/t/188434.aspx">this forum post</a>). Unfortunately, while this works for debugging, this is not a real user situation that you are debugging (since you&#8217;re no longer locked in the container, which is the expected state for any user running your app). In order to get Firefox to still run Silverlight in the container, but not kill it when it detects a Freeze, do the following:</p>
<ol>
<li>type about:config</li>
<li>find dom.ipc.plugins.timeoutSecs (you can start typing it in the filter)</li>
<li>change the value to -1</li>
</ol>
<p>This effectively cancels the timeout so that even though the plugin is no longer responding to Firefox&#8217;s NSAPI messages, it will not be killed.</p>
<p>Happy bug hunting!</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/MaPgJQS9kUo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/debugging-silverlight-in-firefox-3-6-4-and-newer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/debugging-silverlight-in-firefox-3-6-4-and-newer/</feedburner:origLink></item>
		<item>
		<title>System Tray obscures FrameRate counters</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/j2BzHPu6yUg/</link>
		<comments>http://www.nachmore.com/2010/system-tray-obscures-framerate-counters/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 18:18:54 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Do's and Don'ts]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=143</guid>
		<description><![CDATA[Here&#8217;s a small tip for those of you who want to debug performance in a Windows Phone Silverlight app with the frame rate counters, but have the System Tray visible &#8211; hide it.
The counters currently show up behind the system tray (since technically the tray is a system overlay which is drawing over the surface [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a small tip for those of you who want to debug performance in a Windows Phone Silverlight app with the frame rate counters, but have the System Tray visible &#8211; hide it.</p>
<p>The counters currently show up behind the system tray (since technically the tray is a system overlay which is drawing over the surface available to your Silverlight app), so hiding the tray will show the counters.</p>
<p>Don&#8217;t forget: to re-enable the system tray when you&#8217;re done!</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/j2BzHPu6yUg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/system-tray-obscures-framerate-counters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/system-tray-obscures-framerate-counters/</feedburner:origLink></item>
		<item>
		<title>Visual Studio .AddIn File Encoding Error</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/1EvOaLWHif4/</link>
		<comments>http://www.nachmore.com/2010/visual-studio-addin-file-encoding-error/#comments</comments>
		<pubDate>Fri, 14 May 2010 17:59:49 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Extensibility]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=132</guid>
		<description><![CDATA[If you&#8217;re testing the installer for your Visual Studio Add-In and you get the following error when launching Visual Studio:

"Switch from current encoding to specified encoding not supported"


and your .AddIn file looks completely normal when you open it in a text editor, then you're most likely not writing your .AddIn file in Unicode. Since the [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re testing the installer for your Visual Studio Add-In and you get the following error when launching Visual Studio:</p>
<pre><code>
"Switch from current encoding to specified encoding not supported"
</pre>
<p></code></p>
<p>and your .AddIn file looks completely normal when you open it in a text editor, then you're most likely not writing your .AddIn file in Unicode. Since the .AddIn usually specifies:</p>
<pre><code>
&lt;?xml version="1.0" encoding="UTF-16" standalone="no"?&gt;
</code></pre>
<p>Visual Studio expects the file type to be Unicode, so if you wrote your .AddIn file to disk using something like:</p>
<pre><code>
File.WriteAllText(addinFile, addInConfig);
</code></pre>
<p>You'll need to adapt your code to something like:</p>
<pre><code>
File.WriteAllText(addinFile, addInConfig, System.Text.Encoding.Unicode);
</code></pre>
<p>To make sure that the file is Unicode.</p>
<p>Hope that helps!</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/1EvOaLWHif4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/visual-studio-addin-file-encoding-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/visual-studio-addin-file-encoding-error/</feedburner:origLink></item>
		<item>
		<title>Create a WPF based ToolWindow in your Add-In</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/jiP8a6NtquY/</link>
		<comments>http://www.nachmore.com/2010/create-a-wpf-based-toolwindow-in-your-add-in/#comments</comments>
		<pubDate>Wed, 12 May 2010 05:21:38 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Extensibility]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=111</guid>
		<description><![CDATA[One of the big changes in Visual Studio 2010 is the introduction of the WPF based UI which means that (amongst other things) you can now host WPF windows directly within the IDE without having to wrap them inside WinForm controls.
Unfortunately you may notice that if you create a simple WPF UserControl and then try [...]]]></description>
			<content:encoded><![CDATA[<p>One of the big changes in Visual Studio 2010 is the introduction of the <a href="http://blogs.msdn.com/visualstudio/archive/2010/02/15/wpf-in-visual-studio-2010-part-1.aspx">WPF based UI</a> which means that (amongst other things) you can now host WPF windows directly within the IDE without having to wrap them inside WinForm controls.</p>
<p>Unfortunately you may notice that if you create a simple WPF UserControl and then try to create a ToolWindow from it using <a href="http://msdn.microsoft.com/en-us/library/envdte80.windows2.createtoolwindow2.aspx"><code>CreateToolWindow2</code></a>, you&#8217;ll run into the following <a href="http://msdn.microsoft.com/en-us/library/d21c150d.aspx">Managed Debugging Assistant</a>:</p>
<pre><code>
Managed Debugging Assistant 'NonComVisibleBaseClass' has detected a problem in 'c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe'.

Additional Information: A QueryInterface call was made requesting the default IDispatch interface of COM visible managed class 'WPFUserControlAddIn.WPFToolWindow'. 

However since this class does not have an explicit default interface and derives from non COM visible class 'System.Windows.Controls.UserControl', the QueryInterface call will fail. 

This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.
</code></pre>
<p>If you follow through this error message it will lead you to the MSDN page for this error (<a href="http://msdn.microsoft.com/en-us/library/ms172235.aspx">here</a>) and from there to the page that holds <a href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.classinterfaceattribute.aspx">the solution</a>.</p>
<h3 style="padding:10px 0px 10px 0px">The Solution</h3>
<p>Add the following to your <code>[yourfile].xaml.cs</code> around your class declaration:</p>
<pre><code>
    using System.Runtime.InteropServices;
    using stdole;

    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.None)]
    class [yourclass] : UserControl, <b>IDispatch</b>
</code></pre>
<p><b><i>Note</i></b>! Don&#8217;t forget the addition of the <code>IDispatch</code> implementation (there&#8217;s nothing to implement, don&#8217;t worry). Without it you&#8217;ll get <code>"InvalidCastException"</code> from <code>mscordb.lib</code> and a <code>null</code> in your <code>ref</code> object (the last parameter to <code>CreateToolWindow2</code>.</p>
<h3 style="padding:10px 0px 10px 0px">Got a Sample For Us?</h3>
<p>You bet &#8211; grab the <a href=http://www.nachmore.com/wp-content/uploads/2010/05/WPFUserControlAddIn.zip">sample solution</a>. All you need to do is extract, add the .addin file to you AddIns directory (under Documents\Visual Studio 2010\Addins) and away you go.</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/jiP8a6NtquY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/create-a-wpf-based-toolwindow-in-your-add-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/create-a-wpf-based-toolwindow-in-your-add-in/</feedburner:origLink></item>
		<item>
		<title>Media on Windows Phone 7: “Content” Ye Shall Be</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/J7ZBah2eeeI/</link>
		<comments>http://www.nachmore.com/2010/media-on-windows-phone-7-content-ye-shall-be/#comments</comments>
		<pubDate>Tue, 11 May 2010 04:59:12 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Do's and Don'ts]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=107</guid>
		<description><![CDATA[Here&#8217;s an awesome gotcha when moving from a desktop Silverlight application to a Windows Phone 7 application &#8211; make sure that your media (wmv) files are set to &#8220;Build Action&#8221; = &#8220;Content&#8221; and not &#8220;Resource&#8221;.
You&#8217;ll notice that if you do something like:
&#60;MediaElement Source="somevideo.wmv"/&#62;
Where &#8220;somevideo.wmv&#8221; is set to &#8220;Content&#8221;, then the Windows Phone Developer Tools (ie. [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an awesome gotcha when moving from a desktop Silverlight application to a Windows Phone 7 application &#8211; make sure that your media (wmv) files are set to &#8220;Build Action&#8221; = &#8220;Content&#8221; and not &#8220;Resource&#8221;.</p>
<p>You&#8217;ll notice that if you do something like:</p>
<pre><code>&lt;MediaElement Source="somevideo.wmv"/&gt;</code></pre>
<p>Where &#8220;somevideo.wmv&#8221; is set to &#8220;Content&#8221;, then the Windows Phone Developer Tools (ie. Visual Studio) will underline the <code>"Source"</code> attribute and recommend that you set it to &#8220;Resource&#8221;. This is a hangover from the desktop and is something that I hope will go away &#8211; you can safely ignore this warning (it won&#8217;t appear in your build windows).</p>
<p><strong>What&#8217;s Wrong With &#8220;Resource&#8221;?</strong></p>
<p>For those that want more, here are the potential problems you can run into when setting your media to &#8220;Resource&#8221;:</p>
<ol>
<li>When a video file is compiled as a Resource it incurs an extra space and performance hit every time you play it, since Silverlight does extra processing to extract the video from your assembly (DLL). In the case of &#8220;Content&#8221; the file can be read directly from disk (or memory) and you&#8217;ll get instant start playback.</li>
<li>Anything that makes your DLL larger is evil (from my point of view) &#8211; you want your assemblies to be small (think &#8220;quick and nimble&#8221;). Although the size doesn&#8217;t always directly affect load and memory time (there are a couple of other factors at play here) this helps eliminate one more possible bottleneck.</li>
</ol>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/J7ZBah2eeeI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/media-on-windows-phone-7-content-ye-shall-be/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/media-on-windows-phone-7-content-ye-shall-be/</feedburner:origLink></item>
		<item>
		<title>Silverlight Performance Tuning without Profiling</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/UyTGTHBWoc8/</link>
		<comments>http://www.nachmore.com/2010/silverlight-performance-tuning-without-profiling/#comments</comments>
		<pubDate>Mon, 03 May 2010 17:41:37 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.nachmore.com/?p=72</guid>
		<description><![CDATA[An often overlooked performance tuning feature of Silverlight are the &#8220;Frame Rate Counters&#8221; and &#8220;Redraw Regions&#8221; options &#8211; Profiling, step aside! In this post I&#8217;ll explore the general options and how to enable them, I&#8217;ll follow up with a further post on how to use them to help identify performance bottlenecks.
This post is based off [...]]]></description>
			<content:encoded><![CDATA[<p>An often overlooked performance tuning feature of Silverlight are the &#8220;Frame Rate Counters&#8221; and &#8220;Redraw Regions&#8221; options &#8211; Profiling, step aside! In this post I&#8217;ll explore the general options and how to enable them, I&#8217;ll follow up with a further post on how to use them to help identify performance bottlenecks.</p>
<p>This post is based off the <a href="http://live.visitmix.com/MIX10/Sessions/CL60">awesome talk</a> that <a href="http://blogs.msdn.com/seema/">Seema Ramchandani</a> gave at Mix &#8216;10.</p>
<p><em><strong>Note:</strong></em> To test these out either open an existing Silverlight application, or start a new one. The screenshots in this post are mostly from the Windows Phone 7 Emulator (XDE) so will vary slightly to the desktop version.</p>
<h3>Frame Rate Counters</h3>
<ul>
<li style="margin-top: 15px;"><strong>Enabling</strong><br />
Open up <code>App.xaml.cs</code> and add the following bolded line to your <code>App()</code> constructor:<br />
<code> </code></p>
<pre>public App()
{
    UnhandledException += new EventHandler(Application_UnhandledException);
    InitializeComponent();

    <strong>App.Current.Host.Settings.EnableFrameRateCounter = true;</strong>
}
</pre>
</li>
<li style="margin-top: 15px;"><strong>What you&#8217;ll see</strong>
<div style="margin-bottom: 1em;">In the top left corner of the screen you should see the following counters:</div>
<div id="attachment_73" class="wp-caption alignnone" style="width: 221px"><img class="size-full wp-image-73" title="Frame Rate Counters" src="http://www.nachmore.com/wp-content/uploads/2010/05/framerate_counters.png" alt="Frame Rate Counters" width="211" height="18" /><p class="wp-caption-text">Silverlight Framerate Counters</p></div>
<p><strong><em><br />
Note:</em></strong> On the desktop counter A &amp; B are merged into one counter.</li>
<li style="margin-top: 15px;"><strong>I don&#8217;t see the counters! (mobile)</strong><br />
This means that you are running without hardware acceleration. Either the machine running the emulator does not support hardware acceleration (DirectX 10 for the early refreshes) or you&#8217;ve run into a bug (there are a number of them which are currently being zapped) which has caused your device / emulator to run out of video memory. Restart the device / emulator and you should be right.</p>
<p><strong>Note:</strong> To tell if your emulator supports hardware acceleration (or if your device has run out of video memory) look at your screen as you launch a XAP &#8211; if it does the page flip animation then you&#8217;re ok, otherwise if the app just appears then you are in software.</li>
<li style="margin-top: 15px;"><strong>What do they mean?</strong>
<div style="margin-bottom: 1em;">I&#8217;ve added letters to indicate the different fields as so:</div>
<p><img class="size-full wp-image-74" title="framerate_counters_letters" src="http://www.nachmore.com/wp-content/uploads/2010/05/framerate_counters_letters.png" alt="" width="201" height="46" /></p>
<ol type="A">
<li>Render Thread Framerate (fps) <strong>(mobile only)</strong></li>
<li>UI Thread Rate Framerate (fps)</li>
<li>Amount of VRAM used by App (kb)</li>
<li>Total number of textures on GPU</li>
<li>Number of intermediate textures</li>
</ol>
</li>
</ul>
<h3>Redraw Regions</h3>
<ul>
<li style="margin-top: 15px;"><strong>Enabling</strong><br />
Open up <code>App.xaml.cs</code> and add the following bolded line to your <code>App()</code> constructor:<br />
<code> </code></p>
<pre>public App()
{
    UnhandledException += new EventHandler(Application_UnhandledException);
    InitializeComponent();

    <strong>App.Current.Host.Settings.EnableRedrawRegions = true;</strong>
}
</pre>
</li>
<li style="margin-top: 15px;"><strong>What you&#8217;ll see</strong><br />
In this example I&#8217;m using the default Windows Phone list application and clicking through the list options and then back with the hardware back button.</p>
<p><div id="attachment_88" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.nachmore.com/wp-content/uploads/2010/05/redraw_regions_11.png"><img class="size-medium wp-image-88" title="Redraw Regions Transitions" src="http://www.nachmore.com/wp-content/uploads/2010/05/redraw_regions_11-300x166.png" alt="" width="300" height="166" /></a><p class="wp-caption-text">Redraw Regions highlighting redrawn areas as we transition between pages</p></div></li>
<li style="margin-top: 15px;"><strong>What am I looking at?</strong><br />
Redraw regions highlights (tints) every part of the screen as it is redrawn, either due to a user initiated action (say, scrolling a non-cached list box) or some code (animation). Cached Objects that are being animated / moved / scrolled etc (BitmapCache) will not be redrawn, but as soon as the object is modified (say, you change its colour as it moves), it will be redrawn &#8211; and you will see this highlighted by EnabledRedrawRegions.</p>
<div></div>
<p>As regions are redrawn the colours will cycle through Blue, Yellow, Pink (Purple) so that you can see the transition &#8211; there is no significance to the specific colours.</li>
</ul>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/UyTGTHBWoc8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2010/silverlight-performance-tuning-without-profiling/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2010/silverlight-performance-tuning-without-profiling/</feedburner:origLink></item>
	</channel>
</rss>
