<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Colin Thomsen's Microsoft Blog : Visual Studio</title><link>http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx</link><description>Tags: Visual Studio</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>VS2010: New Profiler Summary Page</title><link>http://blogs.msdn.com/colinth/archive/2009/12/31/vs2010-new-profiler-summary-page.aspx</link><pubDate>Thu, 31 Dec 2009 22:16:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9942707</guid><dc:creator>colinth</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/colinth/comments/9942707.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=9942707</wfw:commentRss><description>&lt;p&gt;With Visual Studio 2010 we want to make it easier for customers to find and fix performance issues with their code. One of the first things we looked at was the view that shows up after profiling an application – the Summary Page.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;I’ll describe a few features of the new summary page using the PeopleTrax application, which you can &lt;a href="http://code.msdn.microsoft.com/VSTS2010B1PeopleTrax"&gt;download from CodeBox&lt;/a&gt;. I won’t describe collecting the profiling data since this is already &lt;a href="http://msdn.microsoft.com/en-us/library/ms182398(VS.100).aspx"&gt;covered on MSDN&lt;/a&gt;. The summary page for a sample profiling run is shown below.&lt;/p&gt;  &lt;p align="left"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/summary_sampling_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="summary_sampling" border="0" alt="summary_sampling" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/summary_sampling_thumb.png" width="800" height="628" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I’ll describe the individual pieces of the report below:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The header shows the type of data collected (Sample, Instrumentation, etc.) and also how many samples were collected.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__header_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sampling__header" border="0" alt="sampling__header" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__header_thumb.png" width="226" height="50" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;The hot path is shown right on the front page.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__hotpath_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="sampling hotpath" border="0" alt="sampling hotpath" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__hotpath_thumb.png" width="702" height="170" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;We can see straight away that the ReadLine() function is an interesting function to look at. Clicking on the hyperlink will take you directly to the Function Details page. There are also related views links to navigate directly to the ‘Call Tree’ and ‘Functions’ views.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Functions that are doing the most individual work (have the highest Exclusive Samples) are listed with visual ‘sparklines’ (bar charts) to indicate relative importance.      &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__exclusive_functions_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="sampling exclusive functions" border="0" alt="sampling exclusive functions" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__exclusive_functions_thumb.png" width="702" height="155" /&gt;&lt;/a&gt;       &lt;br /&gt;Clicking on the hyperlink for a function takes you directly to the Function Details page for that function.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Notifications that change based on the state of the report are shown in a new ‘Notifications’ area. In the example below, clicking Show All Code will reanalyze the report with Just My Code turned off. ‘View Guidance’ will bring up the Error List to display guidance from the new Rules and Guidance profiler feature.     &lt;br /&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__notifications_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; vertical-align: top; border-top: 0px; margin-right: 0px; border-right: 0px" title="sampling notifications" border="0" alt="sampling notifications" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__notifications_thumb.png" width="199" height="94" /&gt;&lt;/a&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Action links are shown in the ‘Report’ area and they do not depend on the state of the report. One useful link we added is ‘Toggle Full Screen’ which shows the report in full-screen mode.     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__actions_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="sampling actions" border="0" alt="sampling actions" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__actions_thumb.png" width="201" height="234" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;A chart of CPU usage (for sampling, although we also show contention data in Concurrency mode) enables filtering of the report data. Highlight a region on the chart and choose ‘Filter by selection’ to show data from only that period of time. For example, with the chart below it may be useful to filter between 16 and 24 seconds.     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__chart_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="sampling chart" border="0" alt="sampling chart" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__chart_thumb.png" width="702" height="237" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;At the top of the report above the header, we still have the profiler toolbar which is useful for navigating (see the left and right arrows and also the dropdown for jumping between views) and for executing some of the actions that are also listed on the Summary Page.     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__toolbar_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="sampling toolbar" border="0" alt="sampling toolbar" src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VS2010NewProfilerSummaryPage_C09C/sampling__toolbar_thumb.png" width="567" height="25" /&gt;&lt;/a&gt;&amp;#160;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Hopefully these new features on the front page will make it quicker and easier than ever to diagnose your performance issues.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9942707" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/vs2010/default.aspx">vs2010</category></item><item><title>PDC 2008 - See the Sessions</title><link>http://blogs.msdn.com/colinth/archive/2008/11/01/pdc-2008.aspx</link><pubDate>Sun, 02 Nov 2008 00:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9028580</guid><dc:creator>colinth</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/colinth/comments/9028580.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=9028580</wfw:commentRss><description>&lt;P&gt;This year if you didn't get a chance to go to the &lt;A href="http://microsoftpdc.com/" mce_href="http://microsoftpdc.com/"&gt;Professional Developer's Conference (PDC)&lt;/A&gt;, there is still a wealth of information available to you. The most valuable resource I think are the videos of all the PDC sessions. Here are a few of the sessions that I've viewed and found most interesting:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/pdc2008/TL24/" mce_href="http://channel9.msdn.com/pdc2008/TL24/"&gt;Improving .NET Application Performance and Scalability&lt;/A&gt;, starring my boss Steve Carroll and Ed Glass,&amp;nbsp;this session&amp;nbsp;covers a bunch of new Visual Studio 2010 Profiler features.&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/pdc2008/TL59/"&gt;Visual Studio Debugger Tips &amp;amp; Tricks&lt;/A&gt;, with speaker John Cunningham who is a Microsoft&amp;nbsp;Development Manager (and Steve's boss),&amp;nbsp;covering features in Visual Studio 2008, 2008 SP1 and features to look forward to in Visual Studio 2010. Note to self 'if you ever ship without symbols, I would fire you'.&lt;/LI&gt;
&lt;LI&gt;&lt;A id=ctl00_MainPlaceHolder_TitleLink href="http://channel9.msdn.com/pdc2008/TL03/"&gt;Microsoft Visual Studio Team System: Software Diagnostics and Quality for Services&lt;/A&gt;, featuring Habib and Justin, who are&amp;nbsp;also&amp;nbsp;folks from the diagnostics team. The most exciting demo from this talk shows off the cool&amp;nbsp;new Historical Debugging feature. It also features the new Test Impact Analysis feature, which can tell you which tests you should run after changing your code.&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/pdc2008/PC58/" mce_href="http://channel9.msdn.com/pdc2008/PC58/"&gt;Framework Design Guidelines&lt;/A&gt;, by the guys who wrote the book of the same name, Krzysztof Cwalina and Brad Adams. If you write managed code this is a must-see session.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If you'd like to try some of the Visual Studio 2010 features for yourself, you can &lt;A href="https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=9790" mce_href="https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=9790"&gt;download&amp;nbsp;the newest&amp;nbsp;CTP here&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9028580" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio+Team+System/default.aspx">Visual Studio Team System</category><category domain="http://blogs.msdn.com/colinth/archive/tags/vs2008/default.aspx">vs2008</category><category domain="http://blogs.msdn.com/colinth/archive/tags/vs2010/default.aspx">vs2010</category></item><item><title>Tech-Ed 2008 Demos</title><link>http://blogs.msdn.com/colinth/archive/2008/06/02/tech-ed-2008-demos.aspx</link><pubDate>Tue, 03 Jun 2008 06:25:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8570835</guid><dc:creator>colinth</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/colinth/comments/8570835.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=8570835</wfw:commentRss><description>&lt;p&gt;Last year my &lt;a href="http://blogs.msdn.com/colinth/archive/2007/06/03/tech-ed-2007.aspx"&gt;boss took a trip to sunny Orlando&lt;/a&gt; to present at Tech-Ed and to offer help and suggestions in the Technical Learning Center (TLC). This year I'm lucky enough to be attending with a couple of other folks (Habib and Tim) and since I'm not an official Speaker I'll be spending most of my time hanging out in the Application Lifecycle Management (ALM) demo station for Visual Studio 2008 Team System, Development Edition.&lt;/p&gt;  &lt;p&gt;We've prepared a few demos covering things like:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Profiling using Instrumentation Mode on a Virtual PC image.&lt;/li&gt;    &lt;li&gt;Collecting Allocation and Object Lifetime information.&lt;/li&gt;    &lt;li&gt;Analyzing Performance Reports.&lt;/li&gt;    &lt;li&gt;Using Code Analysis to improve your code.&lt;/li&gt;    &lt;li&gt;Enabling Code Analysis Check-In Policies.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;We're also looking forward to discussing your specific scenarios so if you're at Tech-Ed and interested in diagnostic tools and solving performance problems we'd love to chat with you.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8570835" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio+Team+System/default.aspx">Visual Studio Team System</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.msdn.com/colinth/archive/tags/dev/default.aspx">dev</category></item><item><title>Performance: Inserting Marks Using Code</title><link>http://blogs.msdn.com/colinth/archive/2008/05/01/inserting-marks-using-code.aspx</link><pubDate>Thu, 01 May 2008 17:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8569496</guid><dc:creator>colinth</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/colinth/comments/8569496.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=8569496</wfw:commentRss><description>&lt;P&gt;Ian previously covered &lt;A href="http://blogs.msdn.com/ianhu/archive/2007/07/17/the-visual-studio-profiler-data-collection-control-part-1-excluding-application-startup-time.aspx" mce_href="http://blogs.msdn.com/ianhu/archive/2007/07/17/the-visual-studio-profiler-data-collection-control-part-1-excluding-application-startup-time.aspx"&gt;using the VS 2008 Data Collection Control to choose when to collect data&lt;/A&gt;. The Data Collection Control can also be used to insert marks into the performance report, but sometimes it is convenient to modify the source code to do this automatically.&lt;/P&gt;
&lt;P&gt;Consider a typical application (&lt;A href="http://msdn.microsoft.com/en-us/library/ms182399.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms182399.aspx"&gt;PeopleTrax&lt;/A&gt;) where I am interested in gathering profiler data only between when a button is clicked and when data is displayed. The application is shown below.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/pre_click.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/pre_click.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=420 alt=pre_click src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/pre_click_thumb.png" width=480 border=0 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/pre_click_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;After the 'Get People' button is clicked, data is displayed after just over 6 seconds. This seems a little excessive so I want to focus my performance investigation in this area.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/post_click.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/post_click.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=420 alt=post_click src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/post_click_thumb.png" width=480 border=0 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/post_click_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;To filter the data so that it only shows information collected between those two points, I could use the Data Collection Control, but maybe I'm planning to run a complicated scenario and don't want to have to remember to insert the marks manually. Instead, it is possible to modify the original code to request the profiler insert marks in the required locations.&lt;/P&gt;
&lt;P&gt;The Profiler API is available for managed code in an assembly that can be added directly to the project from \Program Files\Microsoft Visual Studio 9.0\Team Tools\Performance Tools.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_zoom_border_2.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_zoom_border_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=423 alt=add_ref_zoom_border src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_zoom_border_thumb.png" width=480 border=0 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_zoom_border_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;After adding the reference it shows up in the 'References' list for the PeopleTrax project.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_done_zoom_border_2.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_done_zoom_border_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=277 alt=add_ref_done_zoom_border src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_done_zoom_border_thumb.png" width=222 border=0 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/add_ref_done_zoom_border_thumb.png"&gt;&lt;/A&gt; &lt;BR&gt;&lt;/P&gt;
&lt;P&gt;I can then use functions in the Profiler API to control the profiler. This might include starting or stopping data collection or in this case, inserting marks into the datastream. This is easily achieved as shown below.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/mark_in_code_2.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/mark_in_code_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=262 alt=mark_in_code src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/mark_in_code_thumb.png" width=640 border=0 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/mark_in_code_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;I can then profile the application and when I open the Performance Report and switch to Marks View I see that the marks have been correctly inserted. We can also see that the time elapsed between the marks is about 6.5 seconds, which corresponds with the measurement that is already displayed in the PeopleTrax UI.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/marks_view_zoom_border_2.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/marks_view_zoom_border_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=205 alt=marks_view_zoom_border src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/marks_view_zoom_border_thumb.png" width=519 border=0 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/marks_view_zoom_border_thumb.png"&gt;&lt;/A&gt; &lt;BR&gt;&lt;/P&gt;
&lt;P&gt;I can use the marks to filter the report to only show profiling data for the time between the two inserted marks and then start my performance investigation.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/filter_on_marks_border_4.png" mce_href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/filter_on_marks_border_4.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=296 alt=filter_on_marks_border src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/filter_on_marks_border_thumb_1.png" width=495 border=0 mce_src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/InsertingMarksUsingCode_10AFE/filter_on_marks_border_thumb_1.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8569496" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio+Team+System/default.aspx">Visual Studio Team System</category><category domain="http://blogs.msdn.com/colinth/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.msdn.com/colinth/archive/tags/dev/default.aspx">dev</category></item><item><title>Performance: Find Application Bottlenecks With Visual Studio Profiler</title><link>http://blogs.msdn.com/colinth/archive/2008/03/13/performance-find-application-bottlenecks-with-visual-studio-profiler.aspx</link><pubDate>Thu, 13 Mar 2008 20:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8182701</guid><dc:creator>colinth</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/colinth/comments/8182701.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=8182701</wfw:commentRss><description>&lt;P&gt;If you're a subscriber to &lt;A class="" href="http://msdn2.microsoft.com/en-us/magazine/default.aspx" mce_href="http://msdn2.microsoft.com/en-us/magazine/default.aspx"&gt;msdn magazine&lt;/A&gt;,&amp;nbsp;take a look at the article in the March 2008, Vol 23, No 4 issue on Page 81 which describes how to use the Visual Studio 2008 profiler to improve the performance of an application. A couple of members of the profiler team examine a Mandelbrot fractal drawing program in some detail. They isolate and fix several performance problems in the code, speeding up program execution approximately tenfold.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; You can read the article &lt;A class="" href="http://msdn2.microsoft.com/en-us/magazine/cc337887.aspx" mce_href="http://msdn2.microsoft.com/en-us/magazine/cc337887.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8182701" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio+Team+System/default.aspx">Visual Studio Team System</category></item><item><title>Visual Studio Team System Chat – December 5th</title><link>http://blogs.msdn.com/colinth/archive/2007/11/21/visual-studio-team-system-chat-december-5th.aspx</link><pubDate>Wed, 21 Nov 2007 22:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6458339</guid><dc:creator>colinth</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/colinth/comments/6458339.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=6458339</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Join members of the Visual Studio Team System product group to discuss features available in Team Foundation Server, Team Suite, Architecture Edition, Development Edition, Database Edition, and Test Edition. In addition, discuss what's new for these editions for Visual Studio 2008.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;We will be holding two sessions:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Join the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/chats" mce_href="http://msdn.microsoft.com/chats"&gt;&lt;FONT face="Times New Roman" size=3&gt;chat&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; on Wednesday, December 5th, 2007 from 10:00am - 11:00am Pacific Time. &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/communities/chats/vcs/07_1205_msdn_VSTS10.ics" mce_href="http://www.microsoft.com/communities/chats/vcs/07_1205_msdn_VSTS10.ics"&gt;&lt;FONT face="Times New Roman" size=3&gt;Add to Calendar&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; | &lt;/FONT&gt;&lt;A href="http://www.timeanddate.com/worldclock/fixedtime.html?month=12&amp;amp;day=5&amp;amp;year=2007&amp;amp;hour=10&amp;amp;min=0&amp;amp;sec=0&amp;amp;p1=234" mce_href="http://www.timeanddate.com/worldclock/fixedtime.html?month=12&amp;amp;day=5&amp;amp;year=2007&amp;amp;hour=10&amp;amp;min=0&amp;amp;sec=0&amp;amp;p1=234"&gt;&lt;FONT face="Times New Roman" size=3&gt;Additional Time Zones&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;-and-&lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Join the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/chats" mce_href="http://msdn.microsoft.com/chats"&gt;&lt;FONT face="Times New Roman" size=3&gt;chat&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; on Wednesday, December 5th, 2007 from 4:00pm - 5:00pm Pacific Time. &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/communities/chats/vcs/07_1205_msdn_VSTS4.ics" mce_href="http://www.microsoft.com/communities/chats/vcs/07_1205_msdn_VSTS4.ics"&gt;&lt;FONT face="Times New Roman" size=3&gt;Add to Calendar&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; | &lt;/FONT&gt;&lt;A href="http://www.timeanddate.com/worldclock/fixedtime.html?month=12&amp;amp;day=5&amp;amp;year=2007&amp;amp;hour=16&amp;amp;min=0&amp;amp;sec=0&amp;amp;p1=234" mce_href="http://www.timeanddate.com/worldclock/fixedtime.html?month=12&amp;amp;day=5&amp;amp;year=2007&amp;amp;hour=16&amp;amp;min=0&amp;amp;sec=0&amp;amp;p1=234"&gt;&lt;FONT face="Times New Roman" size=3&gt;Additional Time Zones&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;---&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true"&gt;I'll be in the Wed 4 pm - 5 pm chat to answer any questions related to profiling. Another member of the profiler team will be online for the earlier chat.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true"&gt;---&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6458339" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio+Team+System/default.aspx">Visual Studio Team System</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.msdn.com/colinth/archive/tags/dev/default.aspx">dev</category></item><item><title>Microsoft Blogs I Read</title><link>http://blogs.msdn.com/colinth/archive/2007/10/16/microsoft-blogs-i-read.aspx</link><pubDate>Tue, 16 Oct 2007 21:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5407961</guid><dc:creator>colinth</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/colinth/comments/5407961.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=5407961</wfw:commentRss><description>&lt;P&gt;There are a lot of Microsoft bloggers, literally thousands of them. When I first joined Microsoft I wasn't sure who to read. I've gradually built up a list based on interesting product and feature announcements and people I've met. Here they are:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Profiling&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/profiler" mce_href="http://blogs.msdn.com/profiler"&gt;Our Team Blog&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/ianhu" mce_href="http://blogs.msdn.com/ianhu"&gt;IanWho's Blog&lt;/A&gt;. Written by a fellow dev on the profiler team, Ian has probably written the most about profiling across the team.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/ms_joc/" mce_href="http://blogs.msdn.com/ms_joc/"&gt;joc's bLog&lt;/A&gt;. Written by my bosses' boss.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/mgoldin/" mce_href="http://blogs.msdn.com/mgoldin/"&gt;mgoldin's blog&lt;/A&gt;. Written by a senior dev on my team. Find out about the difference between different types of samples etc.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/chrissc/" mce_href="http://blogs.msdn.com/chrissc/"&gt;My Code Does What?!&lt;/A&gt;. A relatively new blog about profiling by another fellow dev.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/scarroll" mce_href="http://blogs.msdn.com/scarroll"&gt;scarroll's Blog&lt;/A&gt;. Written by my boss.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Technical&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/bharry/default.aspx" mce_href="http://blogs.msdn.com/bharry/default.aspx"&gt;bharry's WebLog&lt;/A&gt;. Written by a Technical Fellow (&lt;A class="" href="http://blogs.msdn.com/anutthara/archive/2007/08/17/brian-harry-is-now-technical-fellow.aspx" mce_href="http://blogs.msdn.com/anutthara/archive/2007/08/17/brian-harry-is-now-technical-fellow.aspx"&gt;read more about this&lt;/A&gt;) with a huge amount of experience who has a big focus on TFS.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/greggm" mce_href="http://blogs.msdn.com/greggm"&gt;Greggm's Weblog&lt;/A&gt;. Written by a senior dev on the Debugger team. Has many advanced debugger tips.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.technet.com/markrussinovich/" mce_href="http://blogs.technet.com/markrussinovich/"&gt;Mark Russinovich&lt;/A&gt;. Mark wrote some cool &lt;A class="" href="http://www.microsoft.com/technet/sysinternals/default.mspx" mce_href="http://www.microsoft.com/technet/sysinternals/default.mspx"&gt;Sysinternals tools&lt;/A&gt; and now blogs some fascinating posts about his investigation into problems he finds everyday just using his PC.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/ricom" mce_href="http://blogs.msdn.com/ricom"&gt;Rico Mariani's Performance Tidbits&lt;/A&gt;. Written by a senior Microsoftie who has been here for a long time. Gives tips for analyzing performance and provides guidelines to use in writing .NET code.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://weblogs.asp.net/scottgu" mce_href="http://weblogs.asp.net/scottgu"&gt;ScottGu's Blog&lt;/A&gt;. Find out about LINQ, ASP.NET AJAX etc. etc. This blog has many examples including screenshots and source code.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/somasegar/default.aspx" mce_href="http://blogs.msdn.com/somasegar/default.aspx"&gt;Somasegar's WebLog&lt;/A&gt;.&amp;nbsp;As the corporate VP of DevDiv, Soma covers a lot of Visual Studio features and other developer tools.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Other&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A class="" href="http://internationaltechjobs.spaces.live.com/" mce_href="http://internationaltechjobs.spaces.live.com"&gt;Microsoft International Tech Jobs&lt;/A&gt;. I keep an eye on&amp;nbsp;Microsoft's international opportunities here.&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/jobsblog" mce_href="http://blogs.msdn.com/jobsblog"&gt;Microsoft's JobsBlog&lt;/A&gt;. Discusses many aspects of Microsoft's recruiting. Covers the Vancouver office developments and has tips for prospective Microsofties.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;That's just some of the Microsoft blogs I read. Are there other 'must-reads' that I'm missing?&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5407961" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://blogs.msdn.com/colinth/archive/tags/dev/default.aspx">dev</category></item><item><title>Visual Studio 2008, Beta 2 (now with some of my code)</title><link>http://blogs.msdn.com/colinth/archive/2007/07/27/visual-studio-2008-beta-2-now-with-some-of-my-code.aspx</link><pubDate>Fri, 27 Jul 2007 09:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4075708</guid><dc:creator>colinth</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/colinth/comments/4075708.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=4075708</wfw:commentRss><description>&lt;P&gt;Today we &lt;A href="http://weblogs.asp.net/scottgu/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released.aspx"&gt;released Beta 2&lt;/A&gt; of VS2008. This is the first public release from Microsoft that contains a nontrivial amount of code that I wrote (even though I haven't written too much code just yet). I had barely synched up the source tree and only fixed a couple of bugs when we released Beta 1 but now I've found my feet and am contributing more.&lt;/P&gt;
&lt;P&gt;The major release announcements have focussed on the flashier (and admittedly very cool) aspects of the Beta like &lt;A href="http://en.wikipedia.org/wiki/Language_Integrated_Query" mce_href="http://en.wikipedia.org/wiki/Language_Integrated_Query"&gt;LINQ&lt;/A&gt; and some of the HTML editing and Javascript debugging features. However, us Profiler folks have also been toiling away adding new features and fixing bugs. Look out for things like (and some of these already featured in Beta 1, but they just keep getting better):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A promotion to the new Developer menu&lt;BR&gt;&amp;nbsp;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VisualStudio2008Beta2nowwithsomeofmycode_F35B/dev_menu_2.png" atomicselection="true"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" alt=dev_menu src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VisualStudio2008Beta2nowwithsomeofmycode_F35B/dev_menu_thumb_2.png" border=0&gt;&lt;/A&gt; &lt;BR&gt;
&lt;LI&gt;Hot path - find the critical path/paths through your call trees&lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VisualStudio2008Beta2nowwithsomeofmycode_F35B/hotpath.png" atomicselection="true"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=139 alt=hotpath src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VisualStudio2008Beta2nowwithsomeofmycode_F35B/hotpath_thumb.png" width=776 border=0&gt;&lt;/A&gt; 
&lt;LI&gt;Noise reduction - trim and/or fold your call trees so that they are easier to examine. See above for folding example. 
&lt;LI&gt;Comparison reports - compare subsequent profiler runs to determine if code changes are improving performance&lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VisualStudio2008Beta2nowwithsomeofmycode_F35B/comparison_reps.png" atomicselection="true"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=94 alt=comparison_reps src="http://blogs.msdn.com/blogfiles/colinth/WindowsLiveWriter/VisualStudio2008Beta2nowwithsomeofmycode_F35B/comparison_reps_thumb.png" width=275 border=0&gt;&lt;/A&gt; 
&lt;LI&gt;x64 OS support - profile on x64 Vista or W2K3 server&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If you can, please download it and let us know what you think. If you don't have the time at least take a look at the &lt;SPAN style="TEXT-DECORATION: underline"&gt;&lt;/SPAN&gt;&lt;A href="http://channel9.msdn.com/showpost.aspx?postid=329443" mce_href="http://channel9.msdn.com/showpost.aspx?postid=329443"&gt;overview video&lt;/A&gt; showing some of the major features. You should also check out Ian's entry about &lt;A href="http://blogs.msdn.com/ianhu/archive/2007/07/17/the-visual-studio-profiler-data-collection-control-part-1-excluding-application-startup-time.aspx" mce_href="http://blogs.msdn.com/ianhu/archive/2007/07/17/the-visual-studio-profiler-data-collection-control-part-1-excluding-application-startup-time.aspx"&gt;controlling data collection while profiling&lt;/A&gt;. Hopefully I'll have time to go through some of the new profiler-specific features soon.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4075708" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/profiler/default.aspx">profiler</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio+Team+System/default.aspx">Visual Studio Team System</category></item><item><title>C# for C++ Devs: Generics vs Templates for Primitive Types</title><link>http://blogs.msdn.com/colinth/archive/2007/07/02/c-for-c-users-generics-vs-templates-for-primitive-types.aspx</link><pubDate>Tue, 03 Jul 2007 03:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3665756</guid><dc:creator>colinth</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/colinth/comments/3665756.aspx</comments><wfw:commentRss>http://blogs.msdn.com/colinth/commentrss.aspx?PostID=3665756</wfw:commentRss><description>&lt;P&gt;I was trying to write some type-generic (almost) code in C# using a pattern that I commonly use in C++. A very simple version of what I was trying to do looks something like:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;class&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; B&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{};&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;template&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;typename&lt;/SPAN&gt; T&amp;gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; convert(T value)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;int&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; main(&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; argc, &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt;* argv[])&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;convert(3.5f);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;convert(11.5);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// The line below would fail with "error C2440: 'type cast' : cannot convert from 'B' to 'int'"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;//convert(B());&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In C++ this compiles and runs just fine, as long as you don't uncomment the&amp;nbsp;convert function for the&amp;nbsp;class. For templates,&amp;nbsp;code is only generated when needed at compile time and as long as the substituted code supports the required functions (or in this case cast), everything is just fine.&lt;/P&gt;
&lt;P&gt;The equivalent C# program using generics looks like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;class&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Program&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp; static int&lt;/SPAN&gt; convert&amp;lt;T&amp;gt;(T value)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Main(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;convert(11.5);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Unfortunately it doesn't compile. I get an error: &lt;FONT size=1&gt;Cannot convert type 'T' to 'int'&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT size=1&gt;&lt;FONT size=2&gt;This is due to the way generics are handled in C#. Instead of having code generated&amp;nbsp;for different types at compile time, generics are resolved to the particular type at runtime (JIT actually). This means that the convert function shown above must support all types at compile time. This is not the case, since generic objects cannot always be converted to integers.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT size=1&gt;&lt;FONT size=2&gt;It is possible to use constraints if you are not using a primitive type, but there doesn't seem to be a nice way to support 'generic across primitive types' in C#. Am I missing something?&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3665756" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/colinth/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/colinth/archive/tags/C_2300_/default.aspx">C#</category></item></channel></rss>