<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Steven Pratschner's .Net CF WebLog</title><subtitle type="html" /><id>http://blogs.msdn.com/b/stevenpr/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/stevenpr/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2007-11-09T16:47:00Z</updated><entry><title>Another book update for “Customizing the Common Language Runtime”</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2011/03/01/another-book-update-for-customizing-the-common-language-runtime.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2011/03/01/another-book-update-for-customizing-the-common-language-runtime.aspx</id><published>2011-03-01T22:42:47Z</published><updated>2011-03-01T22:42:47Z</updated><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3"&gt;A reader recently pointed out another error in my hosting book.&amp;#160; The error involves an API I used in the book that was cut before the final release went out.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3"&gt;On pages 253-256 I describe a hosting API named &lt;font face="Courier New"&gt;IHostControl::GetDomainNeutralAssemblies&lt;/font&gt;.&amp;#160; The idea at the time was that this API could be used by a host to tell the CLR exactly which assemblies to load domain neutral.&amp;#160; Unfortunately I published the book 6 months or so before the final product release (this was .Net Framework 2.0) and by the time the product shipped the CLR team had decided to remove the API.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3"&gt;As such, the options you have to tell the CLR which assemblies to load domain neutral aren’t nearly as granular.&amp;#160; These options are represented by the enumeration called &lt;font face="Courier New"&gt;LoaderOptimization&lt;/font&gt;.&amp;#160; This enumeration is described on page 252 of the book.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3"&gt;My apologies for this error.&amp;#160; Bitten again by releasing the book before the product shipped…&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3"&gt;Steven&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10135714" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>The .Net Compact Framework Configuration Tool</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2008/05/13/the-net-compact-framework-configuration-tool.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2008/05/13/the-net-compact-framework-configuration-tool.aspx</id><published>2008-05-14T00:24:51Z</published><updated>2008-05-14T00:24:51Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;The .Net Compact Framework 3.5 &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C8174C14-A27D-4148-BF01-86C2E0953EAB&amp;amp;displaylang=en"&gt;&lt;font size="2"&gt;Power Toys&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; include a new utility called the NetCF Configuration Tool.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The Configuration Tool is a diagnostic tool.&amp;#160; You won't typically use it in the course of everyday development, but it will come in handy for tasks like diagnosing failures related to device configuration and authoring configuration files.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;While the tool isn't targeted at your application's end users, they will be able to use it with your help should you need them to provide you with information needed to debug a problem remotely.&amp;#160; For this reason, the Configuration Tool runs directly on the mobile device instead of on a desktop machine connected to a device.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;After describing how to install the tool, I'll discuss its four main functional areas:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Displaying which versions of NetCF are installed&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Displaying the contents of the Global Assembly Cache&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Authoring device.config files&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Authoring application configuration files&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Installing the Configuration Tool&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The Configuration Tool isn't automatically installed on the device when you install the Power Toys.&amp;#160; Instead, you must copy it to your device manually. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Fortunately there's only one file to copy: &lt;font face="Courier New" color="#004080"&gt;NetCFcfg.exe&lt;/font&gt;. This file is OS and processor-specific so you'll find it under the appropriate WindowsCE directory in the .Net Compact Framework SDK.&amp;#160; I'm running a WindowsMobile 5.0 device, so the Configuration Tool executable for my device is in: &lt;font face="Courier New" color="#004080"&gt;C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\wce500\armv4i&lt;/font&gt;&lt;/font&gt; &lt;font size="2"&gt;on my desktop machine.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;It doesn't matter which directory you put the file in on your device.&amp;#160; I usually put it in the &lt;font face="Courier New" color="#004080"&gt;\windows&lt;/font&gt; directory but you can deploy the file to any location you please.&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;The About tab&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The &amp;quot;About tab&amp;quot; describes which versions of NetCF are installed on a device.&amp;#160; This is the tab that is displayed when you first launch the Configuration Tool:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2393/2478556401_7b9399ba4e_o.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;It's not unusual to have more than one version of NetCF installed on a device. Most all Windows Mobile and WindowsCE devices come with a version of NetCF in ROM.&amp;#160; Another version is often installed in RAM to support an application that requires a newer version of NetCF than the version that came with the device.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;When multiple versions of NetCF are installed, it's not always obvious which version is being used to run your application.&amp;#160; I've seen several cases where confusion results because an application is running with a different version than expected (see &amp;quot;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2008/03/11/promoting-all-net-compact-framework-applications-on-a-device-using-device-config.aspx"&gt;promoting an application&lt;/a&gt;&amp;quot; for a general description of the rules used to determine which version of NetCF will be used to run an application).&amp;#160; For example, remote tools like the &lt;a href="http://blogs.msdn.com/stevenpr/archive/2008/05/08/the-clr-profiler-for-the-net-compact-framework-series-index.aspx"&gt;CLRProfiler&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/26/what-s-new-in-the-remote-performance-monitor-for-net-compact-framework-3-5.aspx"&gt;Remote Performance Monitor&lt;/a&gt; launch an application on device in order to profile it or gather other performance statistics.&amp;#160; If your application is launched with a version of NetCF other than the one the tool is expecting, the application may start but the tool won't be able to gather the diagnostic information it is looking for.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Knowing which versions of NetCF are installed on the device, which version was used to build your application, and the rules used to determine which version will be used to run your application can help you determine whether any unexpected behavior you are seeing results from the &amp;quot;wrong version of NetCF&amp;quot; problem.&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;The GAC tab&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The GAC tab lists the assemblies installed in the Global Assembly Cache:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2382/2479375148_e85ff23040_o.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;It helps to know the contents of the GAC when diagnosing assembly load failures.&amp;#160; It may be you think an assembly is in the GAC when it isn't, or NetCF may load an assembly from the GAC when you don't expect it to.&amp;#160; If you encounter a failure to load an assembly, use &lt;a href="http://blogs.msdn.com/stevenpr/archive/2005/02/28/381744.aspx"&gt;Loader Logging&lt;/a&gt; to find out why, then check the contents of the GAC using the Configuration Tool if the failure looks related to the GAC.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;The Device Policy tab&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;In a previous post I described how to use &lt;a href="http://blogs.msdn.com/stevenpr/archive/2008/03/11/promoting-all-net-compact-framework-applications-on-a-device-using-device-config.aspx"&gt;device.config&lt;/a&gt; to cause all applications on a device to run with a given version of NetCF.&amp;#160; The Configuration Tool enables you to edit device.config using a GUI rather than having to modify the XML by hand.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2349/2486504869_8609701692_o.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The Device Policy tab let's you choose a version of NetCF to run all &amp;quot;unconfigured&amp;quot; applications on the device.&amp;#160; By &amp;quot;unconfigured&amp;quot; I mean all applications that do not have an application configuration file that contains a &lt;font face="Courier New" color="#004080"&gt;supportedRuntime&lt;/font&gt; element.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In addition to the installed versions of NetCF, you can also select the value &amp;quot;Default&amp;quot;.&amp;#160; Doing so will remove all &lt;font face="Courier New" color="#004080"&gt;supportedRuntime&lt;/font&gt; elements from device.config causing the device to revert to its default behavior for selecting a runtime. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Keep in mind that not all values you select on this tab are &amp;quot;valid&amp;quot; for all applications.&amp;#160; For example,&amp;#160; if I chose 1.0.4292 in the example above, no applications built with later versions of NetCF would run (unless they had configurations files of their own that overrode the device-wide setting).&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;The Application Policy tab&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;In addition to specifying device-wide policy using the Device Policy tab, you can also specify which version of NetCF should be used to run a specific application by using the Application Policy tab.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2351/2487321046_9a525db7fd_o.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The top combo box on the Application Policy tab is pre-populated with all NetCF applications that are installed on the device.&amp;#160; After selecting an application, use the lower combo box to select a version of NetCF to run the application.&amp;#160; Under the covers this dialog is adding (or removing) &lt;font face="courier " color="#004080"&gt;supportedRuntime&lt;/font&gt; elements from your application's configuration file.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Any value chosen using the Application Policy tab overrides values chosen using the Device Policy tab.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Steven&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8501794" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>The CLR Profiler for the .Net Compact Framework Series Index</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2008/05/08/the-clr-profiler-for-the-net-compact-framework-series-index.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2008/05/08/the-clr-profiler-for-the-net-compact-framework-series-index.aspx</id><published>2008-05-09T00:04:17Z</published><updated>2008-05-09T00:04:17Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;I've completed all that I had planned to write (at least for now) about how to use the CLRProfiler with NetCF.&lt;/font&gt;&amp;#160; &lt;font size="2"&gt;Here's a brief explanation and a link to each post the series:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/17/the-clrprofiler-for-the-net-compact-framework-part-1-getting-started.aspx"&gt;&lt;font size="2"&gt;Part I, Getting Started.&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; Describes how to install the profiler, launch an application, and begin collecting profiling data.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/18/the-clrprofiler-for-the-net-compact-framework-part-ii-histograms-and-show-who-allocated.aspx"&gt;&lt;font size="2"&gt;Part II, Histograms and &amp;quot;Show Who Allocated&amp;quot;.&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; The profiler displays various histograms you can use to determine the types and number of objects your application is allocating.&amp;#160; You can also determine what methods in your application cause which types to get allocated.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/11/28/the-clrprofler-for-the-net-compact-framework-part-iii-the-timeline-view.aspx"&gt;&lt;font size="2"&gt;Part III, The Timeline View.&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; The timeline view shows the state of the GC heap over the lifetime of your application.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2008/02/12/the-clrprofiler-for-the-net-compact-framework-part-iv-the-call-tree-view.aspx"&gt;&lt;font size="2"&gt;Part IV, The Call Tree View.&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; Detailed information about every method call and every object allocation is shown in the Call Tree View.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2008/04/22/the-clrprofiler-for-the-net-compact-framework-part-v-controlling-the-profiler-programmatically.aspx"&gt;&lt;font size="2"&gt;Part V, Controlling the Profiler Programmatically.&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; The CLRProfiler generates a large amount of data and significantly slows down your application.&amp;#160; You can programmatically control when the profiler runs using an API that you call from your application.&amp;#160; This API also allows you to insert comments into the profile data and to take a snapshot of the GC on demand.&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Steven&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8474552" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>The CLRProfiler for the .Net Compact Framework, Part V: Controlling the profiler programmatically</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2008/04/22/the-clrprofiler-for-the-net-compact-framework-part-v-controlling-the-profiler-programmatically.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2008/04/22/the-clrprofiler-for-the-net-compact-framework-part-v-controlling-the-profiler-programmatically.aspx</id><published>2008-04-23T03:58:46Z</published><updated>2008-04-23T03:58:46Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;If you've used the CLRProfiler for NetCF you've probably noticed that your application runs much slower when being profiled.&amp;#160; You likely have also seen the huge amount of data the profiler generates, even for relatively simple applications.&amp;#160; The time it takes the profiler to run coupled with the volume of data it creates can sometimes make the profiler impractical to use.&amp;#160; For example, I've had customers tell me that it can take several minutes to start an application while profiling.&amp;#160; If it takes you several more minutes just to navigate to the portion of the application you'd like to profile, it can quickly become extremely frustrating.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The CLRProfiler ships with an additional assembly you can reference and call from your application to control the profiler while your application is running.&amp;#160; This assembly, called &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; contains APIs you can use to start and stop profiling, insert comments into the profiling log, dump the contents of the GC heap on demand, and so on.&amp;#160; The ability to control when the profiler collects data enables you to profile only the sections of your application you want to, rather than having the profiler collect data all the time.&amp;#160; In this way, your application will start faster and there will be less data to sift through later.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In this post I'll describe how to use the APIs provided by the &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;Using the NetCFCLRProfilerControl Assembly&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The following steps are required to use &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; from your application:&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="2"&gt;Reference &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; in your Visual Studio project.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Add code to your application to call the APIs.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Deploy &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; along with your application.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Start your application using the CLRProfiler.&lt;/font&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;Referencing NetCFCLRProfilerControl&lt;/h3&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; is installed on the desktop machine in same directory as the &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfiler&lt;/font&gt; executable.&amp;#160; On my machine the files are in &lt;font face="Courier New" color="#0000ff"&gt;C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\bin.&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;You'll need to add a reference from your application to &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; to use its APIs.&amp;#160; If you're using Visual Studio you can add this reference using the standard &amp;quot;Add Reference...&amp;quot; dialog.&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Public APIs&lt;/h3&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; contains one public class called &lt;font face="Courier New" color="#0000ff"&gt;CLRProfilerControl&lt;/font&gt; which contains the following public static members:&lt;/font&gt;&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="606" border="2"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="229"&gt;&lt;font color="#0000a0" size="2"&gt;Member&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="370"&gt;&lt;font color="#0000a0" size="2"&gt;Notes&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="229"&gt;         &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;bool ProcessIsUnderProfiler { get; }&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="370"&gt;&lt;font size="2"&gt;Returns true if your application was launched using the CLRProfiler.&amp;#160; Note that this is independent of whether the profiler is actually logging allocations or calls at the time.           &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="229"&gt;         &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;bool AllocationLoggingActive { set; get; }&lt;/font&gt; &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="370"&gt;&lt;font size="2"&gt;A boolean property that controls whether the profiler logs managed allocations.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="229"&gt;         &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;bool CallLoggingActive { set; get; }&lt;/font&gt; &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="370"&gt;&lt;font size="2"&gt;A boolean property that controls whether the profiler logs method calls.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="229"&gt;         &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;void LogWriteLine(string comment)&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;void LogWriteLine(string format, params object[] args)&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="370"&gt;&lt;font size="2"&gt;Enables you to insert comments into the profiling log.&amp;#160; These comments show up in the various profiler views to help you narrow down exactly where in your application certain allocations or calls were made.&amp;#160; See the example later in this post.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="229"&gt;         &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;void DumpHeap()&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="370"&gt;&lt;font size="2"&gt;Causes the profiler to display a graphical view of the GC heap.&amp;#160; Individual views will also show up on the profiler's summary form when the application exits.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Deploying your application&lt;/h3&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; is not installed on the device automatically.&amp;#160; You'll need to deploy it along with your application.&amp;#160; It's probably easiest to deploy &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; to the same directory as your application but you can also install it in the GAC if you prefer.&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Launching your application&lt;/h3&gt;  &lt;p&gt;&lt;font size="2"&gt;The APIs provided by &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; have no effect if your application isn't started using the CLRProfiler.&amp;#160; However, assuming you are going to use the APIs to control when the profiler logs allocations and/or calls, be sure to clear the relevant checkboxes on the profiler's main form before launching your application (otherwise you'll be logging all the stuff you wanted to prevent in the first place!).&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm4.static.flickr.com/3044/2434621505_5a6a359be3_o.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;After clearing the checkboxes, start your application using the profiler as you always have.&amp;#160; The actions of the profiler will now be controlled by your application instead of the CLRProfiler's user interface.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;Turning profiling on and off&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;Assuming you've started your application with the &amp;quot;Profile&amp;quot; checkboxes on the profiler's main form cleared, no logging of allocations or calls will occur.&amp;#160; You can turn profiling on using the &lt;font face="Courier New" color="#0000ff"&gt;AllocationLoggingActive&lt;/font&gt; and &lt;font face="Courier New" color="#0000ff"&gt;CallLoggingActive&lt;/font&gt; properties.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The following example turns allocation logging on just before entering a loop, then turns logging back off when the loop completes:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;private void btnCheckOut_Click(object sender, EventArgs e)     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;CLRProfilerControl.AllocationLoggingActive = true;&lt;/strong&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; for (int i = 0; i &amp;lt; 20; i++)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; m_cart.ProcessCart();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;CLRProfilerControl.AllocationLoggingActive = false;       &lt;br /&gt;&lt;/strong&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;Inserting comments into the profiling log&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The ability to insert comments into the profiling log is a cool feature that enables you to place your own visual markers into some of the profiler's graphical views.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Here's an example that inserts comments denoting the beginning and end of the execution of a loop:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;private void btnCheckOut_Click(object sender, EventArgs e)     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;CLRProfilerControl.LogWriteLine(&amp;quot;Before ProcessCart loop&amp;quot;);&lt;/strong&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; for (int i = 0; i &amp;lt; 20; i++)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; m_cart.ProcessCart();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;CLRProfilerControl.LogWriteLine(&amp;quot;After ProcessCart loop&amp;quot;);&lt;/strong&gt;      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;After the application exits, your comments show up in several places in the CLRProfiler UI.&amp;#160; First, the summary screen includes a button that brings up a window giving the timestamp of each comment.&amp;#160; You can use this as a rudimentary timing mechanism in your application:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://farm4.static.flickr.com/3067/2435477454_cd9a29e505_o.jpg" /&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The comments also show up in various views throughout the UI&amp;#160; For example, in the Timeline View, the comments show up as vertical green lines that indicate the time at which the comment was logged.&amp;#160; You can see the text of a given comment by hovering the house over its green line.&amp;#160; This allows you to see the state of the GC heap between different points of interest as your application ran.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://farm3.static.flickr.com/2348/2434661163_2513122be5.jpg" /&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;Dumping the GC Heap&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;The final feature available via &lt;font face="Courier New" color="#0000ff"&gt;NetCFCLRProfilerControl&lt;/font&gt; is the ability to take a snapshot of the GC heap on demand.&amp;#160; The &lt;font face="Courier New" color="#0000ff"&gt;DumpHeap&lt;/font&gt; method causes a heap view to be displayed immediately.&amp;#160; You can also access all the heap views taken while the app ran from the Summary View after the application exits.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Steven&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8417658" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Promoting all .Net Compact Framework Applications on a device using device.config</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2008/03/11/promoting-all-net-compact-framework-applications-on-a-device-using-device-config.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2008/03/11/promoting-all-net-compact-framework-applications-on-a-device-using-device-config.aspx</id><published>2008-03-12T03:01:01Z</published><updated>2008-03-12T03:01:01Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;By default, a managed device application is run with the version of the .Net Compact Framework it was built with.&amp;#160; Only if that version is not present on the device will we &amp;quot;promote&amp;quot; the application to run with the latest installed version.&amp;#160; This policy is considered safe and conservative because it isolates applications from unintended compatibility changes that may be introduced in new version of the Framework, at least in the most common scenario.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;However, there are times when you may want to run an application with a version of NetCF other than the one it was built with.&amp;#160; For example you may find that a newer version of NetCF performs better and is more stable than a previous version so you'd like to take advantage of those improvements without having to rebuild your application.&amp;#160; Several previous blog posts (see &lt;a title="http://blogs.msdn.com/davidklinems/archive/2005/11/09/491113.aspx" href="http://blogs.msdn.com/davidklinems/archive/2005/11/09/491113.aspx"&gt;http://blogs.msdn.com/davidklinems/archive/2005/11/09/491113.aspx&lt;/a&gt;) have shown how to do this using an application configuration file.&amp;#160; This approach is manageable as long as you only have a few applications to promote.&amp;#160; But if you'd like to promote a large number of applications it can quickly become a hassle to author all these configuration files and manage their deployment and updates.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Fortunately, version 3.5 of the Compact Framework lets you promote all applications on a device using a single device-wide configuration file.&amp;#160; The syntax of this configuration file is the same as that used in the application configuration file: you specify the version of NetCF you'd like to run all applications with using the &lt;font face="Courier New" color="#004080"&gt;supportedRuntime&lt;/font&gt; element.&amp;#160; The device-wide configuration file must be called &lt;font face="Courier New" color="#004080"&gt;device.config&lt;/font&gt; and must be located in the &lt;font face="Courier New" color="#004080"&gt;\windows&lt;/font&gt; directory.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Here's the contents of a sample &lt;font face="Courier New" color="#004080"&gt;device.config&lt;/font&gt; that will cause all applications to be run with .Net Compact Framework version 3.5:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#004080" size="2"&gt;&amp;lt;configuration&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;startup&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;supportedRuntime version=&amp;quot;v3.5.7238&amp;quot;/&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/startup&amp;gt;       &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#004080" size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="ver" color="#000000" size="2"&gt;There's one more case to consider.&amp;#160; Suppose you've used &lt;font face="Courier New" color="#004080"&gt;device.config&lt;/font&gt; to promote all your applications only to discover that one of your applications doesn't work properly.&amp;#160; In this scenario you'd want to &amp;quot;roll back&amp;quot; just that one application to the version it was built with.&amp;#160; You'd do this by authoring an application configuration file for that application.&amp;#160; Any &lt;font face="Courier New" color="#004080"&gt;supportedRuntime&lt;/font&gt; settings present in application configuration files will override the settings specified in &lt;font face="Courier New" color="#004080"&gt;device.config&lt;/font&gt; thus giving you a quick way to opt-out of your global policy.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" size="2"&gt;Steven&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8163618" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>The CLRProfiler for the .Net Compact Framework, Part IV: The Call Tree View</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2008/02/12/the-clrprofiler-for-the-net-compact-framework-part-iv-the-call-tree-view.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2008/02/12/the-clrprofiler-for-the-net-compact-framework-part-iv-the-call-tree-view.aspx</id><published>2008-02-12T21:10:23Z</published><updated>2008-02-12T21:10:23Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;This series of posts provides an introduction to using the CLRProfiler for the .Net Compact Framework.&amp;#160; In previous posts (&lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/17/the-clrprofiler-for-the-net-compact-framework-part-1-getting-started.aspx"&gt;part 1&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/18/the-clrprofiler-for-the-net-compact-framework-part-ii-histograms-and-show-who-allocated.aspx"&gt;part 2&lt;/a&gt;, and &lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/11/28/the-clrprofler-for-the-net-compact-framework-part-iii-the-timeline-view.aspx"&gt;part 3&lt;/a&gt;) we've looked at various profiler features as we try to solve a performance problem with a sample application.&amp;#160; So far, we've learned that our performance problem is due to excessive boxing of value types.&amp;#160; We've also learned what type of objects we are boxing and what methods in the sample are causing the boxing to occur.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In some cases, knowing which method is causing the problem is all you need, especially if the method is small and straightforward.&amp;#160; However, there are cases where even more detail is needed.&amp;#160; In this post I'll use the Call Tree View to determine the &lt;em&gt;exact line of source code&lt;/em&gt; that is causing my performance issue!&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;After you've finished profiling, you can bring up the Call Tree View from the summary page:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2002/2231705450_aee3a468b8.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;The Call Tree View&lt;/h1&gt;  &lt;p&gt;&lt;font size="2"&gt;The Call Tree View shows every allocation made as a result of every method call.&amp;#160; For all but the simplest programs the Call Tree View contains a huge amount of data.&amp;#160; Fortunately, navigating through all this data isn't very hard once you get used to a few tricks.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Method calls are shown in black and object allocations are shown in green.&amp;#160; For example, the following picture shows the initial state of the Call Tree View.&amp;#160; You can see that only one method (the program's &lt;font face="Courier New"&gt;Main&lt;/font&gt; method) has been called at this outermost level.&amp;#160; You can also see that several allocations have already been made.&amp;#160; These initial allocations are made by the CLR just before it starts executing a program.&amp;#160; As you can see, these initial allocations represent several of the common exception types as well as the initial Application Domain.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2125/2230902073_7c65acbb7e.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Along with the individual method calls and object allocations, the Call Tree View also shows summary statistics such as the number of method calls that result from a given call, the number of bytes and objects allocated by a given call and so on.&amp;#160; You can sort the data either by number of calls or by the amount of memory allocated.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;As you start to expand the tree, you'll notice that one child node at each level is highlighted in bold.&amp;#160; The highlighted node represents the method that has allocated the most memory (or generated the most calls, depending on your sort preference).&amp;#160; This is the key to drilling into the data quickly - just follow the highlighted nodes until you find the method you are looking for.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Back to the Example&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;In previous posts we've established that the objects we are boxing are of type &lt;font face="Courier New"&gt;Box.Block&lt;/font&gt; and that the boxing is occurring in calls to &lt;font face="Courier New"&gt;RotateGameBlocks&lt;/font&gt; and &lt;font face="Courier New"&gt;InitializeGameBlocks&lt;/font&gt;.&amp;#160; By drilling through the data in the Call Tree View we can find out exactly which line of code in &lt;font face="Courier New"&gt;RotateGameBlocks&lt;/font&gt; (or &lt;font face="Courier New"&gt;InitializeGameBlocks&lt;/font&gt;) is causing the boxing to occur.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The following picture shows the result of following the highlighted notes until I have found the &lt;font face="Courier New"&gt;RotateGameBlocks&lt;/font&gt; method.&amp;#160; Some of the methods in the tree look familiar, like &lt;font face="Courier New"&gt;Main&lt;/font&gt;, and &lt;font face="Courier New"&gt;Application.Run&lt;/font&gt;, but many methods don't.&amp;#160; Method names that you don't recognize are likely part of NetCF's internal implementation.&amp;#160; For example, methods that contain &amp;quot;&lt;font face="Courier New"&gt;AGL&lt;/font&gt;&amp;quot; in their name are part of NetCF's implementation of Windows Forms. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;img src="http://farm3.static.flickr.com/2147/2230902115_e5b90213f5.jpg" /&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;When looking at the child nodes of &lt;font face="Courier New"&gt;RotateGameBlocks&lt;/font&gt;, we see a green line representing the allocations of &lt;font face="Courier New"&gt;Box.Block&lt;/font&gt;.&amp;#160; The Objects column tells us that a call to &lt;font face="Courier New"&gt;RotateGameBlocks&lt;/font&gt; causes 14,400 instances of &lt;font face="Courier New"&gt;Box.Block&lt;/font&gt; to be allocated.&amp;#160; Furthermore, we can see that &lt;font face="Courier New"&gt;RotateGameBlocks&lt;/font&gt; calls &lt;font face="Courier New"&gt;ArrayList.set_Item&lt;/font&gt; 14,400 times.&amp;#160; The fact that the number of calls to &lt;font face="Courier New"&gt;ArrayList.set_Item&lt;/font&gt; and the number of instances of &lt;font face="Courier New"&gt;Box.Block&lt;/font&gt; that are allocated are the same indicates that the calling &lt;font face="courier "&gt;ArrayList.set_Item&lt;/font&gt; is the line in my sample that is causing our boxing to occur.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In my next post I'll describe a set of managed APIs you can use to control profiling programmatically.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Steven&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7649678" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author><category term="Diagnostics" scheme="http://blogs.msdn.com/b/stevenpr/archive/tags/Diagnostics/" /></entry><entry><title>PowerToys for the .Net Compact Framework version 3.5 now released!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2007/12/10/powertoys-for-the-net-compact-framework-version-3-5-now-released.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2007/12/10/powertoys-for-the-net-compact-framework-version-3-5-now-released.aspx</id><published>2007-12-11T02:21:57Z</published><updated>2007-12-11T02:21:57Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;We've just released the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C8174C14-A27D-4148-BF01-86C2E0953EAB&amp;amp;displaylang=en"&gt;final 3.5 version of the PowerToys for NetCF&lt;/a&gt; to the web.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;You'll need to install the 3.5 NetCF runtime on your device to use these tools.&amp;#160; For now, you can get the correct runtime by installing &lt;a href="http://msdn.microsoft.com/"&gt;Visual Studio 2008&lt;/a&gt;.&amp;#160; In a few weeks we hope to post a standalone install for NetCF 3.5.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The PowerToys release includes all the tools you need to diagnose issues in your .Net device applications, including the &lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/26/what-s-new-in-the-remote-performance-monitor-for-net-compact-framework-3-5.aspx"&gt;Remote Performance Monitor&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/17/the-clrprofiler-for-the-net-compact-framework-part-1-getting-started.aspx"&gt;CLR Profiler&lt;/a&gt;, the &lt;a href="http://blogs.msdn.com/danhorbatt/archive/2007/11/01/remote-logging-wcf-on-net-compact-framework.aspx"&gt;Logging Utility&lt;/a&gt; and more...&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Steven&lt;/font&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6728543" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>The CLRProfler for the .Net Compact Framework, Part III: The Timeline View</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2007/11/28/the-clrprofler-for-the-net-compact-framework-part-iii-the-timeline-view.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2007/11/28/the-clrprofler-for-the-net-compact-framework-part-iii-the-timeline-view.aspx</id><published>2007-11-28T22:31:37Z</published><updated>2007-11-28T22:31:37Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;In the first two parts of this series (&lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/17/the-clrprofiler-for-the-net-compact-framework-part-1-getting-started.aspx"&gt;part 1&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/stevenpr/archive/2007/10/18/the-clrprofiler-for-the-net-compact-framework-part-ii-histograms-and-show-who-allocated.aspx"&gt;part 2&lt;/a&gt;) I described how to get started using the CLRProfiler and how to use the histograms and the &amp;quot;Show Who Allocated&amp;quot; view to see what types of objects you're allocating and to determine where in your application the allocations are occurring.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In this post I'll talk about my favorite view: the Timeline view.&amp;#xA0; I like the Timeline view because it lets you look at the contents of the GC heap over time.&amp;#xA0; Using this view you can see not only where in your application you are allocating objects, but when. You can also see which objects are collected each time the GC ran.&amp;#xA0; By including a time dimension, the Timeline view combined with &amp;quot;Show Who Allocated&amp;quot; can give you a complete picture of how the use of managed memory varies as your application runs.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;After you've completed profiling, you can launch the Timeline view from the Summary page:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img id="id" src="http://farm3.static.flickr.com/2260/2072014366_1a62e96f25.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#xA0;&lt;/p&gt;  &lt;h1&gt;The Timeline View&lt;/h1&gt;  &lt;p&gt;&lt;font size="2"&gt;The Timeline view has two panes.&amp;#xA0; The right hand pane is the legend and the left hand pane is the contents of the heap.&amp;#xA0; As with the histograms we looked at in part 2, the colors in the legend describe the types of objects present in the heap.&amp;#xA0; Free space in the heap is always white:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img id="id" src="http://farm3.static.flickr.com/2183/2072014404_edee84895b.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The horizontal axis in this view represents time.&amp;#xA0; If you look at the axis you can see when each GC occurred as indicated by the vertical blue markers.&amp;#xA0; By correlating each GC with the contents of the heap displayed above you can get a sense for which objects were freed in each collection.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;font color="#800000"&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;You may notice that each GC is labeled with a generation.&amp;#xA0; The Compact Framework's garbage collector doesn't have the notion of generations so these markers are an artifact of the code we ported from the full .Net Framework. You can ignore them.&lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The vertical axis in the timeline view shows object addresses in the heap.&amp;#xA0; Given that the segments of the GC heap are not necessary contiguous you may seen gaps in these numbers.&amp;#xA0; If you'd like more information about the Compact Framework GC check out the following posts:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2004/07/26/197254.aspx"&gt;An Overview of the .Net Compact Framework's Garbage Collector&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;&lt;a href="http://blogs.msdn.com/stevenpr/archive/2005/12/14/503818.aspx"&gt;GC Heap Management&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;&lt;a href="http://community.opennetcf.com/articles/cf/archive/2007/08/10/don-t-fear-the-garbage-collector.aspx"&gt;Don't Fear the Garbage Collector&lt;/a&gt;&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Back to the Example&lt;/h2&gt;  &lt;p&gt;&lt;font size="2"&gt;Throughout this series of posts I've been using an example of a game I wrote that paints way too slowly.&amp;#xA0; In part 2 we saw that the vast majority of objects I'm creating are of type &lt;font face="Courier New"&gt;Box.Block&lt;/font&gt;.&amp;#xA0; Looking that the Timeline view confirms this as can be seen by looking at the legend and all the red in the view of the heap.&amp;#xA0; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The time-based nature of this view allows us to get a few steps deeper into our analysis.&amp;#xA0; First, we can see the points in time at which allocations of our &lt;font face="Courier New"&gt;Blocks&lt;/font&gt; occurred.&amp;#xA0; In this case, that data isn't very interesting because the view tells me that I was almost continually allocating &lt;font face="Courier New"&gt;Blocks&lt;/font&gt;. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;What's more important in my case is to discover which method in my application was doing the allocations at which point in time.&amp;#xA0; It may be that early on in my application my allocations were coming from &lt;font face="Courier New"&gt;MethodA&lt;/font&gt; while later on they were coming from &lt;font face="Courier New"&gt;MethodB&lt;/font&gt;.&amp;#xA0; This time-based analysis can be particularly useful if you'd like to see all that's happening when your application first starts, for example.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;To see where your allocations are coming from at a given point in time just select that time in the view.&amp;#xA0; This causes a vertical line to appear at that point in the graph.&amp;#xA0; Then right-click and select &amp;quot;Show Who Allocated&amp;quot; from the context menu:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img id="id" src="http://farm3.static.flickr.com/2149/2072014384_e3976a9ce6_o.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Doing so brings up the same Allocation Graph we looked at in part 2, except that the graph shows only the allocations done at that particular point in time.&amp;#xA0; In part 2 we saw that my allocations were coming from two methods: &lt;font face="Courier New"&gt;InitializeGameBlocks&lt;/font&gt; and &lt;font face="Courier New"&gt;RotateGameBlocks&lt;/font&gt;.&amp;#xA0; By using the timeline view I can see which of those methods was called at which times during my application.&amp;#xA0; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Next time I'll describe the Call Tree view that will show even more detail by highlighting the exact lines within my methods that are causing the spurious allocations to occur.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Steven&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights&lt;/p&gt;  &lt;p&gt;   &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6583673" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Calling the EnumServices Win32 API from your .Net Compact Framework Application</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2007/11/20/calling-the-enumservices-win32-api-from-your-net-compact-framework-application.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2007/11/20/calling-the-enumservices-win32-api-from-your-net-compact-framework-application.aspx</id><published>2007-11-21T04:07:51Z</published><updated>2007-11-21T04:07:51Z</updated><content type="html">&lt;p&gt;&lt;font size="2"&gt;I was helping a customer use PInvoke to call &lt;font face="Courier New"&gt;EnumServices&lt;/font&gt; today and got stuck a few times so I thought it may be helpful to post the solution in case anyone else runs into this someday.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;EnumServices&lt;/font&gt; returns a buffer containing a number of structures of type &lt;font face="Courier New"&gt;ServiceEnumInfo&lt;/font&gt; that describe basic information about the services on a device.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Each &lt;font face="Courier New"&gt;ServiceEnumInfo&lt;/font&gt; structure contains an embedded character array that represents the service's prefix and a pointer to a string that represents the name of the dll that implements the service.&amp;#xA0; The dll names corresponding to the structures are laid out in memory just after the structures themselves.&amp;#xA0; So the contents of the buffer you get back from calling &lt;font face="Courier "&gt;EnumServices&lt;/font&gt; looks like this (this example is from a device with 3 services):&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;img id="id" src="http://farm3.static.flickr.com/2156/2051602442_f2d9d48900_o.jpg" /&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Here's some sample code that calls &lt;font face="Courier New"&gt;EnumServices&lt;/font&gt; and loops the buffer pulling out both the prefix name and the dll name for each service:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;using System;     &lt;br /&gt;using System.Collections.Generic;      &lt;br /&gt;using System.ComponentModel;      &lt;br /&gt;using System.Data;      &lt;br /&gt;using System.Drawing;      &lt;br /&gt;using System.Text;      &lt;br /&gt;using System.Windows.Forms;      &lt;br /&gt;using System.Runtime.InteropServices;      &lt;br /&gt;using System.Diagnostics; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;namespace EnumServices     &lt;br /&gt;{      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; public partial class Form1 : Form      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; {      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // Managed definition of the native ServiceEnumInfo structure.&amp;#xA0; Here's the corresponding native definition:      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; //      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // typedef struct_ServiceEnumInfo {      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; //&amp;#xA0;&amp;#xA0;&amp;#xA0; WCHAR szPrefix[6];      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; //&amp;#xA0;&amp;#xA0;&amp;#xA0; WCHAR szDllName;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; //&amp;#xA0;&amp;#xA0;&amp;#xA0; HANDLE hServiceHandle;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; //&amp;#xA0;&amp;#xA0;&amp;#xA0; DWORD dwServiceState;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // } ServiceEnumInfo;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; //      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; struct ServiceEnumInfo      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; [MarshalAs(UnmanagedType.ByValTStr, SizeConst=6)] public String prefixName;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public IntPtr pDllName; // this value is a pointer to the dll name - not the dll name itself.      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public IntPtr hServiceHandle;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public int dwServiceState;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; [DllImport(&amp;quot;coredll.dll&amp;quot;)]     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; private static extern int EnumServices(IntPtr pBuffer, ref int numEntries, ref int cbBuf); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public Form1()     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; InitializeComponent();      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; private void btnServices_Click(object sender, EventArgs e)     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; int numEntries = 0;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; int cbSize = 0;      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; int structSize = Marshal.SizeOf(typeof(ServiceEnumInfo)); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // call once to get required buffer size     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; int result = EnumServices(IntPtr.Zero, ref numEntries, ref cbSize); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // alloc a buffer of the correct size     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; IntPtr pBuffer = Marshal.AllocHGlobal(cbSize); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // call again to get the real stuff     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; result = EnumServices(pBuffer, ref numEntries, ref cbSize); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // loop through the structure pulling out the prefix and the dll name     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; for (int i = 0; i &amp;lt; numEntries; i++)      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // move a pointer along to point to the &amp;quot;current&amp;quot; structure each time through the loop      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; IntPtr pStruct = new IntPtr(pBuffer.ToInt32()+ (i * structSize)); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // &amp;quot;translate&amp;quot; the pointer into an actual structure     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; ServiceEnumInfo sei = (ServiceEnumInfo)Marshal.PtrToStructure(pStruct, &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; typeof(ServiceEnumInfo)); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; string prefix = sei.prefixName;     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; string dllName = Marshal.PtrToStringUni(sei.pDllName); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // use the prefix and dllName as needed....     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; Debug.WriteLine(prefix);      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; Debug.WriteLine(dllName);      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // remember to free the buffer that we allocated     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; Marshal.FreeHGlobal(pBuffer); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }     &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; }      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#004080" size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Steven&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6447873" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Great .Net Compact Framework Content at Oredev</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/stevenpr/archive/2007/11/09/great-net-compact-framework-content-at-oredev.aspx" /><id>http://blogs.msdn.com/b/stevenpr/archive/2007/11/09/great-net-compact-framework-content-at-oredev.aspx</id><published>2007-11-10T03:47:00Z</published><updated>2007-11-10T03:47:00Z</updated><content type="html">&lt;P&gt;&lt;FONT size=2&gt;Next week is the annual &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;A href="http://www.oredev.org/" mce_href="http://www.oredev.org"&gt;Øredev&lt;/A&gt; &lt;/FONT&gt;conference in Malmö, Sweden.&amp;nbsp; We're very fortunate to have 3 detailed .Net Compact Framework sessions there.&amp;nbsp; Doug Boling will be doing sessions on &lt;A href="http://www.oredev.org/toppmeny/conference/embeddedsystem/compactframeworkperformance.4.76e8b1c6112f078db498000127374.html" mce_href="http://www.oredev.org/toppmeny/conference/embeddedsystem/compactframeworkperformance.4.76e8b1c6112f078db498000127374.html"&gt;performance&lt;/A&gt; and on how to &lt;A href="http://www.oredev.org/toppmeny/conference/embeddedsystem/towritegpsenabledapplications.4.76e8b1c6112f078db498000127345.html" mce_href="http://www.oredev.org/toppmeny/conference/embeddedsystem/towritegpsenabledapplications.4.76e8b1c6112f078db498000127345.html"&gt;enable GPS in your applications&lt;/A&gt; and I'll be doing a session on how to use the &lt;A href="http://www.oredev.org/toppmeny/conference/embeddedsystem/newandimproveddiagnostictools.4.76e8b1c6112f078db498000129363.html" mce_href="http://www.oredev.org/toppmeny/conference/embeddedsystem/newandimproveddiagnostictools.4.76e8b1c6112f078db498000129363.html"&gt;.Net Compact Framework diagnostic tools&lt;/A&gt; to solve tough issues like performance problems or memory leaks.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I'll also be presenting a session on &lt;A href="http://www.oredev.org/toppmeny/conference/net/silverlightindepth.4.76e8b1c6112f078db498000126618.html" mce_href="http://www.oredev.org/toppmeny/conference/net/silverlightindepth.4.76e8b1c6112f078db498000126618.html"&gt;Silverlight 1.1&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If you're in that part of the world next week it's a great chance to get access to some .Net Compact Framework content.&amp;nbsp; Doug Boling knows a ton about WindowsCE and is a great resource.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Steven&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This posting is provided "AS IS" with no warranties, and confers no rights.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6034039" width="1" height="1"&gt;</content><author><name>stevenpr</name><uri>http://blogs.msdn.com/stevenpr/ProfileUrlRedirect.ashx</uri></author></entry></feed>