So much content! How do I choose?
Welcome to //BUILD
This year’s BUILD conference is June 26-28 at the Moscone Center in San Francisco, California. This will be the first broad discussion and distribution of the next versions of Windows and Internet Explorer, and we hope to see many of you there!
The IE engineering team will have seven presentations at BUILD focusing on techniques and tools for building fast, touch-friendly, and immersive sites that harness the power of Windows. If you are at the show, we would encourage you to attend any of the following:
Session | Title | Summary |
2-066 | New IE Developer Tools. | F12 developer tools have been completely re-imagined for IE11. |
2-067 | New Platform Capabilities for Advancing Web Development | Learn how to take advantage of the latest Web technologies, interoperably. |
3-068 | Web run-time performance | Learn new techniques for analyzing and improving site performance. |
3-069 | Web Compatibility and Same Markup | Build sites that provide great experiences across modern browsers. |
3-071 | Lighting up your site on Windows 8.1 | Leverage the power of the Windows platform to create amazing sites. |
4-072 | Hyper-fast Web graphics with WebGL | Learn how to create sites that provide 3D graphic experiences for IE11. |
4-073 | Inspecting & Debugging Using IE’s New F12 Developer Tools | Deep dive on inspection of markup and debugging of JavaScript with the new F12 tools. |
As you can see, there are a lot of exciting new things coming in the next version of IE, and we will be sharing all of the details here on the IE Blog. And finally, during the conference you can also join the conversation on Twitter @buildwin.
-Kevin Miller, PM Lead, Internet Explorer
BUILD 2013–the series
I’m in San Francisco and will attend the BUILD Conference that will start tomorrow at 9AM Pacific Time. I will blog from the keynote and the sessions and will also tweet with my twitter account @petbry57. Just registered and got my badge and t-shirt. It actually says STAFF on the back. Cool!
If you are attending, please say hi if you see me. If not, check in on my blog and read about the new stuff that’s coming. Now off to a meet with Swedish attendees and then dinner with colleagues at Western Europe DPE. Life is hard
Exchange Autodiscover Checker
A while back I wrote a basic application which did Autodiscover using the Exchange Managed API and provided some minimal logging. The tool is called Autodiscover Checker and the full code for it can be found on code.msdn.microsoft.com. Over time I have added a lot more to this application by adding more ways to do Autodiscover against Exchange and by improving the logging. Last week I published the 2.2 release.
As of the 2.2 release, the code now shows how to do Autodiscover using:
The Exchange Managed API's Service object.
The Exchange Managed API's Autodiscover object.
Raw C# code which does POX Autodiscover
Raw C# code which does SOAP Autodiscover
Raw C# code which does SCP Lookups
The original code used for POX and SCP came from the Microsoft Exchange WebServices SDK for Exchange 2010 (September 2011). So, you could use the SDK as another source of reference code for POX and SCP work.
I ran into a couple of issues with the Exchange Managed API 2.0. The first was where the service object seemed to go into a redirect loop when there was a redirect email address being returned during Autodiscover. The second issue is that it was not sending credentials at a specific point of doing Autodiscover and the server I was going against had credentials required. I implemented a work-around to this - see the processing tied to the "Work-around Address Redirect Issue" I've added to the "Exchange Managed API Checker" window.
Autodiscover Checker 2.2
http://code.msdn.microsoft.com/office/Autodiscover-Checker-e1ebca42/view/SourceCode
So, if your looking for code to use in your application or need a sample to refer to then please check out this apps code. In addition to its code, it can also be used for troubleshooting.
European Startup 7Write Closes Seed Round of $250,000
Azure Customer Advisory Team @ BUILD
Next week, at Build, folks from the Windows Azure Customer Advisory Team (CAT), will be running a clinic in the Windows Azure are in the Big Room. We'll be there, whiteboard markers at the ready, to get hands-on with:
- Cloud scenarios
- Design and architecture questions
- Troubleshooting and diagnostics
- Sharing best practices from customer deployments
Look for us daily in the Windows Azure area in The Big Room, daily from 9am – 6pm and on Friday till 3pm.
DO’s&DONT’s #18: やった方がいいこと - .NET Framework アプリケーションでパラメータクエリを実行する場合にはパラメータのデータ型やサイズを明示的に指定する
高橋 理香
SQL Developer Support Escalation Engineer
SQL Server では、パラメータ付きのストアドプロシージャを作成して実行したり、sp_executesql を使用してパラメータ クエリを実行することができます。このパラメータ クエリを実行する際には、パラメータのデータ型やパラメータ値が必要となります。また、文字列型やバイナリ型の場合には、サイズの指定も必要です。
一方で .NET Framework Data Provider for SQL Server (以降 SqlClient) を使用するアプリケーションからストアドプロシージャやパラメータ クエリを実行する場合、SqlParameter クラスを使用してパラメータのデータ型等を設定できますが省略することもできます。これは、SqlClient が SqlParameter の Value プロパティに代入された値を基にデータ型やサイズの推論を行っているからです。
しかしながら、パラメータのデータ型やサイズを明示的に指定しなかった場合には、意図しないデータ型やサイズとなることで、クエリのパフォーマンス劣化が発生したり、エラーによって実行できないなどの問題が発生する可能性もあります。そのため、可能な限りパラメータのデータ型やサイズは明示的に記述しておいた方が、アプリケーションの堅牢性の面からもよいでしょう。
推奨事項
- パラメータのデータ型は SQL Server 側のデータ型に合わせて明示的に指定する。
- 文字列やバイナリのデータ型の場合、サイズも明示的に指定する。
- varchar(max) 等の max を使用したデータ型についてはサイズに -1 を指定する。
なぜデータ型を明示的に指定した方がいいのか?
以前に以下のブログで紹介しているように、データ型が一致していない場合にはデータ型変換を行ってから比較を行うことになります。つまり、クエリ パフォーマンスが悪化し、ひいては、アプリケーションのパフォーマンス劣化につながります。
DO's&DONT's #2: 絶対にやらなければいけないこと - データ型を一致させる
データ型変換が発生する例をご紹介しましょう。
ADO.NET では、次のようにパラメータのデータ型やサイズを指定しないパラメータ クエリを実行するコードを記述することができます。
SqlCommand command = new SqlCommand("SELECT * FROM Sales.Customer WHERE AccountNumber = @AccountNumber", connection); command.Parameters.Add(new SqlParameter("@AccountNumber", "AW00011354")); SqlDataReader reader = command.ExecuteReader(); |
この例の場合、パラメータ @AccountNumber のデータ型の指定がないため、渡された値である "AW00011354" を基にデータ型とサイズを推論します。.NET Framework では文字列は Unicode で扱いますので、この結果は、nvarchar(10) になります。したがって、SQL Server で実行される SQL 文は次のようになります。
exec sp_executesql N'SELECT * FROM Sales.Customer WHERE AccountNumber = @AccountNumber', N'@AccountNumber nvarchar(10)', @AccountNumber = N'AW00011354' |
しかし、サンプル データベース AdventureWorks 上の Sales.Customer テーブルの AccountNumber 列は varchar(10) です。したがって、AccountNumber 列をいったん nvarchar (10) に変換し、その結果とパラメータ値を比較する操作が行われることになり、処理に非常に時間がかかる結果となります。
上記を次のように書き換えるだけで、ある環境では 1分以上も要していたクエリが 100ミリ秒程度で完了するようになりました。
SqlCommand command = new SqlCommand("SELECT * FROM Sales.Customer WHERE AccountNumber = @AccountNumber", connection); command.Parameters.Add(new SqlParameter("@AccountNumber", SqlDbType.VarChar)).Value = "AW00011354"; SqlDataReader reader = command.ExecuteReader(); |
データ型として SqlDbType.VarChar を指定しただけでこんなにも違うのであれば、指定した方がいいですよね。
なぜサイズを明示的に指定した方がいいのか?
サイズを明示的に指定しない場合に発生しうる問題として次の2つがあります。
- 最大サイズが使用されることで、作業テーブルを利用したクエリの処理において、テーブルの行の最大許容サイズを超え、エラー 1701 が発生する。
- 推論によって設定されたサイズが最大サイズを超えるため、SQL Server の仕様に沿わないリクエストと判断され、エラーが発生する。
順にどのような状況下で発生するかご説明しましょう。
作業テーブル利用でエラー 1701 が発生するシナリオ
先の例では、Value プロパティに設定されたデータから推論が行われ、データが 10 文字であったためにサイズに 10 が設定されました。
では、NULL 値をパラメータ値として渡した場合、このサイズはどうなるでしょう?
Value プロパティからは長さを推論できませんね。このような場合、指定されているデータ型の最大値がサイズに指定されることになります。
例えば SqlDbType.Char がデータ型として指定されている場合、そのサイズは 8000 と設定されることになります。ここで問題となるのは、SQL Server における SQL 文の処理で並び替えなどのために作業テーブルを必要とする場合です。作業テーブル自体は、他の列に加えて char(8000) の列を含めることになっても作成は成功します。しかし、実際にこの作業テーブルには、SQL Server におけるテーブル行の最大許容サイズの 8094 バイトを超えるレコードが格納されることになるため、制限によって次のエラー 1701 が発生する結果となります。
Msg 1701, Level 16, State 1, Line 1 |
メッセージ 1701, レベル 16, 状態 1, 行 1 |
パラメータに相当する列が char(2) であれば、あらかじめ SqlParameter の Size プロパティに 2 を設定しておくことで、作業テーブルが作成される場合でも、余分なリソースを使うことを避けることができ、かつ、エラーも回避できます。
SqlCommand command = new SqlCommand("SELECT * FROM test1 WHERE column1 = @column1", connection); SqlParameter parameter1 = new SqlParameter(); parameter1.ParameterName = "@column1"; parameter1.SqlDbType = SqlDbType.Char; parameter1.Size = 2; command.Parameters.Add(parameter1); SqlDataReader reader = command.ExecuteReader(); |
推論によって設定されたサイズが最大サイズを超えるシナリオ
非常に長い文字列をパラメータ値として使用する場合について考えてみましょう。
仮にサイズの指定を行っていないと推論が行われることになりますが、基本的にはこの推論は Value プロパティに指定された文字列の長さで決定されることになりますので、8001 バイト以上の文字列の場合には、8001 以上のサイズとして扱われることになります。
しかしながら SQL Server では、varchar(max) や nvarchar(max) などのデータ型で 2GB までのデータの格納を許容できるものの、これらのデータ型における明示的なサイズの指定は varchar の場合には 8000 まで、nvarchar の場合には 4000 までになります。そのため、varchar の場合には 8001 といった数値は不適切なサイズということになります。
推論の結果が SQL Server では不適切なサイズであると判断された場合、SQL Server からは以下のようなエラーが返されます。
着信の表形式のデータ ストリーム (TDS) リモート プロシージャ コール (RPC) プロトコル ストリームが不適切です。パラメーター 24 ("パラメータ名"): データ型 0xA7 に、無効なデータ長またはメタデータ長が指定されています。 |
あらかじめ SQL Server 側のデータ型が varchar(max) などの max を使用するデータ型であった場合には、Size プロパティに -1 を指定しておくことで、この推論を避けることができ、varchar(max) のデータ型にて SQL 文が実行されるようになります。
SqlCommand command = new SqlCommand("INSERT INTO table1 VALUES (@column1, @column2)", connection); command.Parameters.Add(new SqlParameter("@column1", SqlDbType.Int)).Value = 1; command.Parameters.Add(new SqlParameter("@column2", SqlDbType.VarChar, -1)).Value = longText; command.ExecuteNonQuery(); |
参考情報
nchar および nvarchar (Transact-SQL)
char および varchar (Transact-SQL)
binary と varbinary (Transact-SQL)
AlwaysOn Availability Groups Troubleshooting and Monitoring Guide
Having problems with AlwaysOn? Check out the 'AlwaysOn Availability Groups Troubleshooting and Monitoring Guide:'
It contains help when trouble-shooting common availability group issues, introduces useful tools when working with availability groups and how to monitor availability groups.
http://msdn.microsoft.com/en-us/library/dn135328.aspx
Friday App Shout-Out: Rhymes4Kids and Hindu-Calendar
Friday Five-June 28, 2013
1. Incentives for Windows App devs
By Silverlight MVP Cigdem Patlak – @crocusgirl
2. Tom’s Tutorials For Excel: Conditionally Format Five Highest or Lowest Numbers in a List
By Excel MVP Tom Urtis – @TomUrtis
3. Flattening A Parent/Child Relationship in Data Explorer
By SQL Server MVP Chris Webb – @Technitrain
4. Windows Azure Web Sites Demo Series
By Windows Azure MVP Magnus Mårtensson – @noopman
5.Immutability, part 2: Creating a simple immutable stack
By Visual C# MVP Schabse Laks – @Schabse
Tweaks to Project Budget in AX 2012 R2 CU6
Holy //BUILD Batman!
I thought the previous //BUILD conferences had a lot of content but this year definitely surpassed it. Although I couldn’t do the whole conference justice in a single blog post, here are a few key highlights...read more
New book: Microsoft SharePoint 2013 Plain & Simple
Microsoft SharePoint 2013 Plain & Simple is available for purchase.
Get the full-color, visual guide that makes learning Microsoft SharePoint 2013 plain and simple! Follow the book’s easy steps and screenshots and clear, concise language to learn the simplest ways to get things done.
Here’s WHAT you’ll learn:
- Create libraries for all kinds of media
- Share information in one location
- Organize people and processes
- Connect SharePoint to Microsoft Office with no fuss
- Find things fast with the Search Center
- Expand your community with social networking
Here’s HOW you’ll learn it:
- Jump in wherever you need answers
- Follow easy STEPS and SCREENSHOTS to see exactly what to do
- Get handy TIPS for new techniques and shortcuts
- Use TRY THIS! exercises to apply what you learn right away
Babylon.js: How to load a .babylon file produced with Blender
In a previous post, I described Babylon.js, a brand new 3D engine for WebGL and JavaScript. Among others features, Babylon.js is capable of loading a JSON file through the .babylon file format.
During this post, I will show you how to use Babylon.js API to load a scene created with Blender.
Creating a scene and exporting a .babylon file with Blender
In my previous post, I already described how to install the .babylon exporter in Blender, but for the sake of comprehension, I copy/paste the process here:
First of all, please download the exporter script right here: http://www.babylonjs.com/Blender2Babylon.zip.
To install it in Blender, please follow this small guide:
- Unzip the file to your Blender’s plugins folder (Should be C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons for Blender 2.67 x64).
- Launch Blender and go to File/User Préférences/Addon and select Import-Export category. You will be able to activate Babylon.js exporter.
- Create your scene
- Go to File/Export and select Babylon.js format. Choose a filename and you are done !
Once the exporter is installed, you can unleash your artist side and create the most beautiful scene your imagination can produce. In my case, it will be fairly simple:
- A camera
- A point light
- A plane for the ground
- A sphere
Just to be something a bit less austere, I will add some colors for the ground and the sphere:
I will also add a texture for the sphere. This texture will be used for the diffuse channel of the material:
Please pay attention to:
- Use Alpha checkbox to indicate to Babylon.js to use alpha values from the texture
- Color checkbox to indicate that this texture must be use for diffuse color
Once you are satisfied (You can obviously create a more complex scene), just go to File/Export/Babylon.js to create your .babylon file.
Loading your .babylon Inside your page/app
First of all, you should create a simple html web page:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Using babylon.js - How to load a scene</title> <script src="babylon.js"></script> <style> html, body { width: 100%; height: 100%; padding: 0; margin: 0; overflow: hidden; } #renderCanvas { width: 100%; height: 100%; } </style> </head> <body> <canvas id="renderCanvas"></canvas> </body> </html>
This page is pretty simple because all you need is just a canvas and a reference to babylon.js.
Then you will have to use BABYLON.SceneLoader object to load your scene. To do so, just add this script block right after the canvas:
<script> if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); } </script>
the Load function takes the following parameters:
- scene folder (can be empty to use the same folder as your page)
- scene file name
- a reference to the engine
- a callback to give you the loaded scene (in my case, I use this callback to attach the camera to the canvas and to launch my render loop)
- a callback for progress report
Once the scene is loaded, just wait for the textures and shaders to be ready, connect the camera to the canvas and let’s go!
Fairly simple, isn’t it?
Please note that the textures and the .babylon file must be side by side
Another function is also available to interact with .babylon files: BABYLON.SceneLoader.importMesh:
BABYLON.SceneLoader.ImportMesh("spaceship", "Scenes/SpaceDek/", "SpaceDek.babylon", scene, function (newMeshes, particleSystems) { });
This function is intended to import meshes (with their materials and particle systems) from a scene to another. It takes the following parameters:
- object name (if you omit this parameter, all the objects are imported)
- scene folder (can be empty to use the same folder as your page)
- scene file name
- a reference to the target scene
- a callback to give you the list of imported meshes and particle systems
Playing with your scene
The result is as expected: a orange plane lighted by a point light with a floating sphere using an RGBA texture for its diffuse color. You can use the mouse and the cursors keys to move:
For IE11 preview, you can also directly try the result just here: http://www.babylonjs.com/tutorials/blogs/loadScene/loadscene.html
The full source code is also available there:
http://www.babylonjs.com/tutorials/blogs/loadScene/loadScene.zip
Enjoy!
Others chapters
If you want to go more deeply into babylon.js, here are some useful links:
- Introducing Babylon.js: http://blogs.msdn.com/b/eternalcoding/archive/2013/06/27/babylon-js-a-complete-javascript-framework-for-building-3d-games-with-html-5-and-webgl.aspx
- How to load a scene exported from Blender: http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx
Visual Studio 2013 y Apps Windows 8.0 y 8.1
Los dos últimos fueron días muy interesantes y de instalar muchos updates y conocer muchas novedades.
En este thread de Facebook pueden encontrar el paso a paso de las novedades declaradas en el Keynote 1 del Build 2013, dedicado especialmente al lanzamiento del preview de Windows 8.1. Y en este el Keynote 2.
Este lanzamiento estuvo acompañado de otros como el de los preview de Visual Studio 2013 y el Framework .net 4.5.1.
Interesantemente, me vi tentado a descargar el preview de VS2013 primero.
Cuando lo tuve listo, lo instalé sobre una de mis máquinas con Windows 8.0.
Aquí me llevé una sorpresa, al ver que no aparecían templates para desarrollar Windows Store Apps!
Entonces esperé a que bajara la ISO del instalador del preview de Windows 8.1 y cuando estuvo lista la instalé en otra máquina actualizando desde Windows 8 a Windows 8.1 sin mayores problemas.
Obviamente después de instalarla instalé allí de nuevo el preview de VS2013 y tal como lo supuse, allí si obtuve los templates de Windows Store Apps.
Con todo el deseo de formalizar el conocimiento que había adquirido experimentalmente, consulté con el gran Soma Somasegar (Vicepresidente de la División de Desarrolladores en Microsoft), quien muy amablemente me confirmó lo siguiente:
Apps de Win 8.0:
- Se pueden CREAR solo desde VS2012 sobre WIN8.0/WIN8.1
- Se pueden EDITAR/COMPILAR desde VS2012/VS2013 sobre WIN8.0/WIN8.1
Apps de Win 8.1
- Se pueden CREAR/EDITAR/COMPILAR Solo desde VS2013 sobre WIN8.1
Esto explica perfectamente por qué los templates para nuevas apps solo aparecen con VS2013 en WIN8.1.
Personalmente lo entiendo como una forma de estimular que en adelante enfoquemos las apps a WIN8.1 por defecto, a menos que sea un caso supremamente exótico que requiera que vayan para WIN8.0, en cuyo caso deberemos recurrir a VS2012.
Tengamos en cuenta que el upgrade a WIN8.1 será gratuito y automático. Así que es raro querer hacer una nueva app para WIN8.0. Además que TODAS las apps de WIN8.0 se ejecutan correctamente en WIN8.1 sin necesidad de ningún update.
Que hay de Windows 7?
Amablemente me comentó @jramirezdev que intentó instalar el preview de VS2013 en Win7 y no pudo, ya que el instalador le pide IE10, que claramente indica que VS2013 solo puede ser instalado en Win8 o Win8.1
Using Visual Studio 2013 to write maintainable native visualizations (natvis)
In Visual Studio 2012 we introduced the ability to create visualizations for native types using natvis files. Visual Studio 2013 contains several improvements that make it easier to author visualizations for classes that internally make use of collections to store items. In this blog post I’ll show an example scenario that we wanted to improve, show you what you have to do in VS2012 to achieve the desired results, and then show you how the natvis authoring gets easier with VS2013 by exploring some of our new enhancements.
Example scenario
Let’s consider the following source code and suppose we are interesting in writing a visualizer for the CNameList class:
#include <vector> using namespace std; class CName { private: string m_first; string m_last; public: CName(string first, string last) : m_first(first), m_last(last) {} void Print() { wprintf(L"%s %s\n", (const char*) m_first.c_str(), (const char*) m_last.c_str()); } }; class CNameList { private: vector m_list; public: CNameList() {} ~CNameList() { for (int i = 0; i < m_list.size(); i++) { delete m_list[i]; } m_list.clear(); } void AddName(string first, string last) { m_list.push_back(new CName(first, last)); } }; int _tmain(int argc, _TCHAR* argv[]) { CNameList presidents; presidents.AddName("George", "Washington"); presidents.AddName("John", "Adams"); presidents.AddName("Thomas", "Jefferson"); presidents.AddName("Abraham", "Lincoln"); return 0; }
Our goal is to get ‘presidents’ to display like this:
CNameList visualizer for Visual Studio 2012
In Visual Studio 2012, it can be tricky for some to author the visualization for the CNameList class. The most obvious natvis authoring:
<?xml version="1.0" encoding="utf-8"?><AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"><Type Name="CNameList"><Expand><ExpandedItem>m_list</ExpandedItem></Expand></Type><Type Name="CName"><DisplayString>{m_first} {m_last}</DisplayString><Expand><Item Name="First">m_first</Item><Item Name="Last">m_last</Item></Expand></Type></AutoVisualizer>
Would display like this:
While the first and last names of the presidents are there, the view is a lot more cluttered than we may like. Since we want to visualize the content of the CNameList object, rather than its implementation details, we may not care about the size or capacity of the internal vector, nor about the memory address of each CName object in the list, or the quotes around the first and last names to indicate that they are stored as separate strings. With Visual Studio 2012, removing this clutter is possible, but it is rather cumbersome, and requires the visualization for CName and CNameList to be coupled with implementation details of the STL. For example, in VS2012 we could get rid of the size and capacity of the vector, as well as the memory addresses of the CName objects, by replacing the visualizer for CNameList with this:
<Type Name="CNameList"><Expand><IndexListItems><Size>m_list._Mylast - m_list._Myfirst</Size><ValueNode>*m_list._Myfirst[$i]</ValueNode></IndexListItems></Expand></Type>
And we could get rid of the quotes around the first and last names by replacing the CName visualizer with this, which uses the “,sb” format specifier to remove the quotes around the characters in the string:
<Type Name="CName"><DisplayString Condition="m_first._Myres < m_first._BUF_SIZE && m_last._Myres < m_last._BUF_SIZE">{m_first._Bx._Buf,sb} {m_last._Bx._Buf,sb}</DisplayString><DisplayString Condition="m_first._Myres >= m_first._BUF_SIZE && m_last._Myres < m_last._BUF_SIZE">{m_first._Bx._Ptr,sb} {m_last._Bx._Buf,sb}</DisplayString><DisplayString Condition="m_first._Myres < m_first._BUF_SIZE && m_last._Myres >= m_last._BUF_SIZE">{m_first._Bx._Buf,sb} {m_last._Bx._Ptr,sb}</DisplayString><DisplayString Condition="m_first._Myres >= m_first._BUF_SIZE && m_last._Myres >= m_last._BUF_SIZE">{m_first._Bx._Ptr,sb} {m_last._Bx._Ptr,sb}</DisplayString><Expand><Item Condition="m_first._Myres < m_first._BUF_SIZE" Name="First">m_first._Bx._Buf,sb</Item><Item Condition="m_first._Myres >= m_first._BUF_SIZE" Name="First">m_first._Bx._Ptr,sb</Item><Item Condition="m_last._Myres < m_last._BUF_SIZE" Name="Last">m_last._Bx._Buf,sb</Item><Item Condition="m_last._Myres >= m_last._BUF_SIZE" Name="Last">m_last._Bx._Ptr,sb</Item></Expand></Type>
While these visualizations certainly work in the sense that they yield the desired clutter-free output in the watch window, they require more work to write and maintain. First, the visualizers for both CNameList and CName now take dependencies on private members of classes in the STL. As implementation details the STL are subject to change, these visualizers are at risk of not working in a future version of Visual Studio if the STL implementation changes something that these entries depend on. Furthermore, if CNameList is distributed as a header file that could potentially be included from any version Visual Studio, you might need to include a separate natvis entry for CName, for each implementation of the STL, then have to update all of them, any time in the future that the implementation of CName changes.
Furthermore, when the visualizer for the internal class has conditionals in it, the conditionals end up multiplying in ways that make the visualizer a mess. For instance, the built-in visualizer for std::basic_string has two possible display string cases:
<Type Name="std::basic_string<char,*>"><DisplayString Condition="_Myres < _BUF_SIZE">{_Bx._Buf,s}</DisplayString><DisplayString Condition="_Myres >= _BUF_SIZE">{_Bx._Ptr,s}</DisplayString><StringView Condition="_Myres < _BUF_SIZE">_Bx._Buf,s</StringView><StringView Condition="_Myres >= _BUF_SIZE">_Bx._Ptr,s</StringView><Expand><Item Name="[size]">_Mysize</Item><Item Name="[capacity]">_Myres</Item><ArrayItems><Size>_Mysize</Size><ValuePointer Condition="_Myres < _BUF_SIZE">_Bx._Buf</ValuePointer><ValuePointer Condition="_Myres >= _BUF_SIZE">_Bx._Ptr</ValuePointer></ArrayItems></Expand></Type>
However, because CName contains both a first name and a last name, there are now four cases, instead of two, based on whether the first and last names are contained in _Bx._Buf or _Bx._Ptr. If we were to enhance CName to store middle names as well, now the visualizer would be up to eight cases, as the number of cases doubles for each new name you want to display. So we wanted to offer a cleaner way.
CNameList Visualizer for Visual Studio 2013
In Visual Studio 2013, you can achieve an uncluttered view of CNameList in the watch window by writing your visualizer like this:
<?xml version="1.0" encoding="utf-8"?><AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"><Type Name="CNameList"><Expand><ExpandedItem>m_list,view(simple)na</ExpandedItem></Expand></Type><Type Name="CName"><DisplayString>{m_first,sb} {m_last,sb}</DisplayString><Expand><Item Name="First">m_first,sb</Item><Item Name="Last">m_last,sb</Item></Expand></Type></AutoVisualizer>
This view visualization works by taking advantage of three new natvis features in Visual Studio 2013: multiple views of an object, a format specifier to suppress memory addresses of pointers, and the ability of format specifiers to propagate across multiple natvis entries. Let’s examine all three next.
Multiple Object Views
In Visual Studio 2012, a <Type> entry can only describe one way to view an object. For example, because the default view of a vector includes child nodes for the size and capacity, every natvis entry that wants to show a vector must either also include child nodes for the size and capacity or inline the vector visualizer into the visualizer of the type that uses the vector.
In Visual Studio 2013, each type still has only one default view, and it is now possible for a natvis entry to define additional views that can be accessed through an appropriate format specifier. For example, the Visual Studio 2013 visualization of std::vector does so like this:
<Type Name="std::vector<*>"><DisplayString>{{ size={_Mylast - _Myfirst} }}</DisplayString><Expand><Item Name="[size]" ExcludeView="simple">_Mylast - _Myfirst</Item><Item Name="[capacity]" ExcludeView="simple">_Myend - _Myfirst</Item><ArrayItems><Size>_Mylast - _Myfirst</Size><ValuePointer>_Myfirst</ValuePointer></ArrayItems></Expand></Type>
The <DisplayString> and the <ArrayItems> elements are used always, while the “[size]” and “[capacity]” items are excluded from a view that has a name of “simple”. Normally, objects are displayed using the default view, which will show all the elements. However, the “,view” format specifier can be used to specify an alternate view, as shown this example of a simple vector of integers. Note that “vec,view(xxx)” behaves exactly the same as the default view because the natvis entry for vector does not contain any special behavior for a view of “xxx”.
If you want a natvis element to be added to, rather than removed from a particular view, you can use the “IncludeView” attribute, instead of “ExcludeView”. You may also specify a semi-colon delimited list of views in “IncludeView” and “ExcludeView” attributes, if you want the attribute to apply to a set of views, rather than just one. For example, this visualization will show the display text of “Alternate view” using either “,view(alternate)” or “,view(alternate2)”, and “Default View” in other cases.
<Type Name="MyClass"><DisplayString IncludeView="alternate; alternate2">Alternate view </DisplayString><DisplayString>Default View</DisplayString></Type>
So, going back to our example, our CNameList visualizer takes advantage of the “simple” view defined in the “vector” visualizer to eliminate the clutter of the size and capacity nodes:
<Type Name="CNameList"><Expand><ExpandedItem>m_list,view(simple)na</ExpandedItem></Expand></Type>
Skipping Memory Addresses
Visual Studio 2013 adds a new format specifier, “,na”. When applied to a pointer, the “,na” format specifier causes the debugger to omit the memory address pointed to, while still retaining information about the object. For example:
In our CNameList example, we use the “,na” format specifier to hide the memory addresses of the CName objects, which are unimportant. Without the “,na” format specifier, hiding the memory addresses would have required copy-pasting and modifying the visualizer for std::vector to make it dereference the elements inside of the vector, like this:
<Type Name="CNameList"><Expand><IndexListItems><Size>m_list._Mylast - m_list._Myfirst</Size><ValueNode>*m_list._Myfirst[$i]</ValueNode></IndexListItems></Expand></Type>
In our CNameList example, we use the “,na” format specifier to hide the memory addresses of the CName objects, which are unimportant. Without the “,na” format specifier, hiding the memory addresses would have required copy-pasting and modifying the visualizer for std::vector to make it dereference the elements inside of the vector, as illustrated here.
It should also be noted that the “,na” format specifier is not quite the same as the dereferencing operator “*”. Even though the “,na” format specifier will omit the memory address of the data being pointed to, any available symbolic information about that address will still be displayed. For example, in the function case, “*wmain” would be a syntax error, but “wmain,na” shows the module and signature of the “wmain” function, omitting the memory address. Similarly, “&myGlobal,na” still shows you that the pointer is pointing to the symbols “int myGlobal”. The “,na” format specifier can also be used on memory addresses in the middle of a function, as illustrated in the “(void*)eip,na” example. This can make the “,na” format specifier quite attractive for visualizing stack traces that have been logged inside of objects, for debugging purposes.
Propagating Format Specifiers
Even though the “,sb” format specifier already exists in Visual Studio 2012, authoring the CName visualizer like this does not work in VS2012:
<Type Name="CName"><DisplayString>{m_first,sb} {m_last,sb}</DisplayString><Expand><Item Name="First">m_first,sb</Item><Item Name="Last">m_last,sb</Item></Expand></Type>
The reason is that “m_first” is not actually a char*, but rather an std::basic_string. Because of this, Visual Studio 2012 actually obtains the format specifier for the underlying char* from the std::basic_string visualizer, not the CName visualizer. While the use of “m_first,sb” is still legal syntax, under Visual Studio 2012, the “,sb” in CName’s visualizer actually gets completely ignored.
In the meantime, because the visualizer for std::basic_string is designed to work for the common case, the std::basic_string uses “,s”, not “,sb”, causing the quotes to be included. Hence, while your intention was to get stripped out, they are actually still there . In Visual Studio 2012, the only workaround without changing std::basic_string, and potentially messing up other visualizations, not related to CName, is to inline the contents of std::basic_string into CName’s visualizer, so the string being used with “,sb” is actually a direct char*, rather than an std::basic_string.
In Visual Studio 2013, format specifiers used on visualized objects get merged with format specifiers of the object’s visualizer itself, rather than getting thrown out. In other words, in Visual Studio 2013, the “b” in “m_first,sb” propagates to the strings shown in the std::basic_string visualizer, allowing the quotes to be nicely and easily stripped out, without needing to modify or inline the visualizer for std::basic_string.
Another example of propagation of format specifiers is our new visualizer for CNameList. Even if the “,na” format specifier did exist in Visual Studio 2012, without the propagation of format specifiers, “m_list,na” would still not work, as the “,na” would simply be ignored due to std::vector’s visualizer not using “,na”. In Visual Studio 2013, the “,na” format specifier automatically propagates to the elements of the vector and things just work.
Yet another good example of propagation of format specifiers is displaying the elements of an integer collection in hexadecimal. The “,x” format specifier to display an integer in hex is already present in Visual Studio 2012, but only when applied directly to an integer value. When applied to a vector object, Visual Studio 2012 will simply ignore it, like this:
In Visual Studio 2012, showing the vector elements in hex would have required either modifying the visualizer for std::vector so that every vector would have its elements in hex, or toggling the global “hexadecimal display” option, which would cause every watch item to be formatted in hex, not just that one vector.
In Visual Studio 2013, “,x” simply propagates down to the children of the vector automatically, like this:
Other Visualization improvements
While the above features are all that is necessary to make our CNameList example work, there are a few other natvis-related improvements that have been asked for and are worth mentioning as well:
Using the final implementation name of a class inside a display string:
In Visual Studio 2013, a natvis entry for a base class may make use of the name of the object’s implementation class the $(Type) macro inside of a element. For example, if we have this source code:
class Room { private: int m_squareFeet; public: Room() : m_squareFeet(100) {} virtual void Print() = 0; }; class Bedroom : public Room { public: virtual void Print() { printf("Bedroom"); } }; class LivingRoom : public Room { public: virtual void Print() { printf("Living room"); } }; class DiningRoom : public Room { public: virtual void Print() { printf("Dining room"); } }; int _tmain(int argc, _TCHAR* argv[]) { Bedroom br; LivingRoom lr; DiningRoom dr; br.Print(); lr.Print(); dr.Print(); }
We can write one visualizer for class “Room” like this:
<?xml version="1.0" encoding="utf-8"?><AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"><Type Name="Room"><DisplayString>{m_squareFeet}-square foot $(Type)</DisplayString></Type></AutoVisualizer>
that will display which type of room we have, like this:
In Visual Studio 2012, achieving this display would have required creating a separate <Type> element for each type of room.
Note that the use of $(Type) is case-sensitive. $(TYPE) will not work. Also, the use of $(Type) requires the base class to contain at least one virtual function because, without the existence of a vtable, the debugger has no way to know what the object’s implementation class actually is.
Support for Circular Linked Lists
In Visual studio 2013, the <LinkedListItems> element adds support for circular lists that point back to the head of the list to indicate termination. For example, with the following source code:
class CircularList { private: struct Node { int m_value; Node* m_pNext; }; Node* m_pFirst; Node* GetTail() { if (!m_pFirst) return NULL; Node* pNode = m_pFirst; while (pNode->m_pNext != m_pFirst) pNode = pNode->m_pNext; return pNode; } public: CircularList() : m_pFirst(NULL) {} ~CircularList() { Node* pNode = m_pFirst; while (pNode != m_pFirst) { Node* pNext = pNode->m_pNext; delete pNode; pNode = pNext; } } void AddTail(int i) { Node* pNewNode = new Node(); if (m_pFirst) GetTail()->m_pNext = pNewNode; else m_pFirst = pNewNode; pNewNode->m_value = i; pNewNode->m_pNext = m_pFirst; } }; int _tmain(int argc, _TCHAR* argv[]) { CircularList list; list.AddTail(1); list.AddTail(2); list.AddTail(3); return 0; }
We can display the value of ‘list’ with a simple element, like this:
<?xml version="1.0" encoding="utf-8"?><AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"><Type Name="CircularList"><Expand><LinkedListItems><HeadPointer>m_pFirst</HeadPointer><NextPointer>m_pNext</NextPointer><ValueNode>m_value</ValueNode></LinkedListItems></Expand></Type></AutoVisualizer>
In Visual Studio 2013, the output is this:
In Visual Studio 2012, the list would be assumed to go on forever, since the “next” pointer of a list node is never NULL, thereby producing output like this:
Circular list support in Visual Studio 2013 only applies when an element’s “next” pointer points directly back to the head of the list. If a “next” pointer points back to a prior node in the list, that is not at the head, Visual Studio 2013 will still treat the list as continuing forever, just as Visual Studio 2012 does.
Because the “next” pointer expression does have access to fields in the underlying list object, the is no reasonable workaround for Visual Studio 2012.
In Closing
Visual Studio 2013 seeks to address the most common cases in which deficiencies in the natvis framework require compromises in the quality of the visualized view of an object and/or the maintainability of the natvis entries behind it. For feedback on this or any other diagnostics-related features please visit our MSDN forum and I also look forward to your comments below.
Top 10 Microsoft Developer Links for Friday, June 28th
- Carlos Quintero: All-In-One Visual Studio Extensibility Code Samples
- VKichline: Knockout IntelliSense Highlighting Bug Fix
- Visual Studio Toolbox: ComponentOne Controls for XAML Developers
- Alex Simons: Building Multi-Factor Authentication into Your Applications Using the SDK
- David Rousset: Tutorial part 4: learning how to write a 3D software engine in C#, TS or JS – Rasterization & Z-Buffering
- Boby George: Using C++ AMP to Build the Aviary Photo Editor
- John Kimani: Using Bing Maps in Windows Store Apps (JavaScript)
- Craig Kitterman: Building Blocks of Great Cloud Applications
- Ed Price: C# Guru - Spell Checking WinRT Component (C#, VB, HTML5/JavaScript)
- Usman Ur Rehman Ahmed: Required Tools for Windows Phone Development
1834
Treasure Map under the bonnet (hood) #6 … News Island
Now that we have covered the Windows Store App specific design and coding adventures, we can make a quick detour through some other coding gems. Today we will peek behind the solution scene to explore the News feature.
News Feed Feature
Those familiar with the first version of the ALM Rangers Treasure Map with recognise two new island categories, namely Favourites and News. The Treasure Map under the bonnet (hood) #5 … Finishing touches, but not yet finished post briefly mentioned the ability to mark categories and projects as favourites using the AppBar … therefore we can skip that island and sail to the News island.
When we select (click) the News island we are presented with an aggregated list of news titles and summary extracts. In this post we will investigate where these gems come from.
If we look into the TreasureMapDataModel.xml configuration file we recognise a news tag, embracing five (5) RSS feeds. You can explore these feeds to validate that the entries above are indeed legit and to dig into more of the details of each News post.
To explore the News feature you need to visit two areas of the Windows Store App solution.
As always we recommend the use of the CodeMap feature in Visual Studio to visually map the dependencies and execution of the code.
It is evident that the RangersNewsFeed is referenced and called by both the App when initializing and when navigating to the the News View.
Again the team uses Async features to ensure a seemingly instantaneous application initialisation and not bottleneck the application performance and behaviour through the loading of the static configuration for the map and the expensive retrieval of News items.
The code contains some regular expressions. Use the UNISA Chatter – Design patterns in C++ Part 6: Widgets Validation and Regular Expressions post created a long, long ago if you need a quick reference sheet for regular expressions.
Code Samples
These are strictly sample code extracts and may most likely have been updated in the interim to meet quality bars, support new features or other code churn factors.
App Class Constructor
1: public App()
2: {
3: this.InitializeComponent();
4: RangersNewsFeed = new RangersNewsFeed();
5: Database = new DB();
6: Database.LoadDBAsync().ContinueWith(t =>
7: {
8: TileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();
9: TileUpdater.EnableNotificationQueue(true);
10: TileGenerator.GeneratePercentageTile();
11:
12: RangersNewsFeed.LoadItemsAsync().ContinueWith(_ =>
13: {
14: UpdateNewsTiles();
15: });
16: }).Wait();
17: }
RangerNewsFeed.cs
1: //-----------------------------------------------------------------------
2: // <copyright file="RangersNewsFeed.cs" company="Microsoft Corporation">
3: // Copyright Microsoft Corporation. All Rights Reserved. This code released under the terms of the Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.) This is sample code only, do not use in production environments.
4: // </copyright>
5: //-----------------------------------------------------------------------
6:
7: namespace Microsoft.ALMRangers.VsarTreasureMap.WindowsStoreApp.News
8: {
9: using System;
10: using System.Collections.Generic;
11: using System.Linq;
12: using System.Text.RegularExpressions;
13: using System.Threading.Tasks;
14: using Windows.Web.Syndication;
15:
16: /// <summary>
17: /// Defines the class which handles retrieval of RSS feeds.
18: /// </summary>
19: internalclass RangersNewsFeed
20: {
21: /// <summary>
22: /// The closing paragraph break tag
23: /// </summary>
24: private Regex closingParagraphBreakTag = new Regex("</?[pP]>");
25:
26: /// <summary>
27: /// The line break tag
28: /// </summary>
29: private Regex lineBreakTag = new Regex("</?[bB][rR]/?>");
30:
31: /// <summary>
32: /// The tag remover regex
33: /// </summary>
34: private Regex tagRemoverRegex = new Regex("<.*?>");
35:
36: /// <summary>
37: /// Initializes a new instance of the <see cref="RangersNewsFeed"/> class.
38: /// </summary>
39: public RangersNewsFeed()
40: {
41: this.Items = new SortedSet<NewsStory>(new NewsStoryComparer());
42: }
43:
44: /// <summary>
45: /// Gets or sets the items.
46: /// </summary>
47: /// <value>The items.</value>
48: public SortedSet<NewsStory> Items { get; set; }
49:
50: /// <summary>
51: /// Loads the items async.
52: /// </summary>
53: /// <returns>Task.</returns>
54: public async Task LoadItemsAsync()
55: {
56: this.Items.Clear();
57: var client = new SyndicationClient();
58: var tasks = (from url in App.Database.NewsUrls
59: select client.RetrieveFeedAsync(url).AsTask()).ToList();
60:
61: while (tasks.Count > 0)
62: {
63: var nextTask = await Task.WhenAny(tasks);
64: if (nextTask.Status == TaskStatus.RanToCompletion)
65: {
66: this.ParseSyndicationFeed(nextTask.Result);
67: }
68:
69: tasks.Remove(nextTask);
70: }
71: }
72:
73: /// <summary>
74: /// Cleanups the specified content.
75: /// </summary>
76: /// <param name="content">The content.</param>
77: /// <returns>System.String.</returns>
78: privatestring Cleanup(string content)
79: {
80: var result = this.lineBreakTag.Replace(content, Environment.NewLine);
81: result = this.closingParagraphBreakTag.Replace(result, Environment.NewLine);
82: result = this.tagRemoverRegex.Replace(result, string.Empty);
83: result = result.Replace("&", "&");
84: return result.Trim();
85: }
86:
87: /// <summary>
88: /// Parses the syndication feed.
89: /// </summary>
90: /// <param name="syndicationFeed">The syndication feed.</param>
91: privatevoid ParseSyndicationFeed(SyndicationFeed syndicationFeed)
92: {
93: foreach (var item in syndicationFeed.Items)
94: {
95: this.Items.Add(new NewsStory()
96: {
97: Id = item.Id,
98: Title = item.Title.Text,
99: Published = item.PublishedDate.DateTime,
100: Author = item.Authors.Aggregate<SyndicationPerson, string>(
101: string.Empty,
102: (current, next) =>
103: {
104: if (current.Length > 0)
105: {
106: current += ", ";
107: }
108:
109: current += next.NodeValue;
110:
111: return current;
112: }),
113: Content = this.Cleanup(item.Summary.Text),
114: Link = item.Links[0].Uri
115: });
116: }
117: }
118: }
119: }
Question Time
Dev Lead question time …
![]() | Q: What, if anything, was a challenge with the News feature and why? | |
Robert MacLean, our dev lead, replies … Nothing :) Windows Store Apps really treat the web as a first class citizen so connecting to websites, grabbing RSS etc... are all built in so it is super easy to work with. Add to that the new async options and we can build some super slick piece of code like LoadItemsAsync, which does the loading of feeds but does it async & loads the content as fast as possible. Now if you asked me, what sections I think could have more work - the number on is Cleanup, which tried to cleanup the HTML for presentation & without a HTML to Text parser we have added some of our own logic but this is an area which could use a better parser than what we have got | ![]() |
Next?
We will peek into the code tracks the progress through the treasure map to see if we can reveal a few more gems.
References
- ALM Readiness Treasure Map Sample Code
- ALM Readiness Treasure Map (Table of Content) TOC Post
- ALM Readiness Treasure Map Windows Store App
- Previous posts:
- Treasure Map under the bonnet (hood) #1 … Windows 8 Layout Controls
- Treasure Map under the bonnet (hood) #2 … Windows 8 Styling
- Treasure Map under the bonnet (hood) #3 … Windows 8 Layout Controls (Update)
- Treasure Map under the bonnet (hood) #4 … Data Binding
- Treasure Map under the bonnet (hood) #5 … Finishing touches, but not yet finished!
Simultaneous CPU/GPU Debugging in Visual Studio 2013
The debugging support introduced for C++ AMP in Visual Studio 2012 has been extended in Visual Studio 2013 when running on Windows 8.1 so that you are able to debug both the CPU and GPU parts of your C++ AMP application simultaneously. In this post I’ll show you how to get started.
1. Configure your project properties
The WARP accelerator on Windows 8.1 is the only accelerator that currently supports simultaneous debugging, so you will need to choose WARP when you want to debug your AMP code. If your application explicitly selects an accelerator then you will need to change your code to select WARP instead. If you are using the default accelerator then the C++ AMP runtime attempts to find the “best” accelerator available on your system to use as the default. Typically this will be your DirectX 11 capable GPU. But you can get the C++ AMP runtime to select WARP as the default accelerator instead via the project properties.
Take any C++ AMP project and set your properties as follows:
- Select Configuration Properties->Debugging
- Set “Debugger Type” to “Native Only” or “Auto”.
- Set “Amp Default Accelerator” to “WARP software accelerator”
2. Set breakpoints in your C++ AMP code
I want to demonstrate both CPU and GPU debugging capabilities so we will start by setting a couple of breakpoints, one in CPU code and another in GPU code. Set the first breakpoint somewhere in your application before the first execution of a parallel_for_each. Set the second breakpoint in the body of a parallel_for_each loop. In my MatrixMultiplication example I have set breakpoints at line 126 (CPU code) and 147 (GPU code).
3. Hit F5 to test CPU debugging
Hit the F5 key (or Debug->Start Debugging menu) to start debugging as normal. You should see your breakpoint in the CPU code get hit. All the usual CPU debugging experience is available.
The breakpoint in the GPU code (at line 147) is displayed with the unbound breakpoint icon. This is because the AMP runtime has not yet created the compute shader corresponding to the loop body. It will do so at the first attempt to execute the parallel_for_each, at which time the breakpoint will bind and the icon will become the familiar red breakpoint icon.
The execution of the body of the parallel_for_each on the GPU is asynchronous with respect to the CPU execution. If you were to advance to the parallel_for_each (line 130) and step (F10) the debugger would remain in the CPU code with the appearance of having stepped over the parallel_for_each – however the loop body will likely not yet have been executed. But since we want to debug into the GPU code we set that second break on line 147 in the loop body. When the loop body eventually gets executed the debugger will break with active GPU state available for examination.
4. Hit F5 to break in the GPU code
Hit the F5 key again and you will advance execution into the GPU code (line 147).
5. Debug the GPU code
To see your GPU thread state open the GPU Threads window (Debug->Windows->GPU Threads). The entire debugger UI is directed at the GPU thread that hit the breakpoint (the currentthread– in this example Tile: [0,0] Thread:[0,0]). The call stack window will show the GPU thread’s call stack, and expressions in the locals, watch, and autos windows will all be evaluated in the GPU context. The parallel watch window will allow you to evaluate expression across all active GPU threads.
6. Check the CPU state
When stopped at a GPU breakpoint the CPU portion of the application is also stopped. You can easily view the CPU state without having to continue execution until you exit the GPU code. Just open the Threads window (Debug->Windows->Threads). Set your debugger context back to a CPU thread by double clicking on your main thread. The entire debugger experience is now focused on the CPU portion of your program. Once you are finished you can return to the GPU by double clicking on a line in the GPU Threads window.
Limitations
The simultaneous debugging experience is only available when your application executes on Windows 8.1 and uses the WARP software driver. WARP on earlier versions of Windows does not support debugging. Debugging GPU code on previous versions of Windows is still possible with VS 2013 using the “GPU Only” debugger type and remains unchanged from Visual Studio 2012.
When simultaneous debugging on WARP a few GPU debugging features are unavailable: race detection, freezing and thawing of GPU threads, and “Run Current Tile to Cursor”. All this functionality continues to be available when “GPU Only” debugging.
Note for Visual Studio 2013 Preview: In the preview release simultaneous debugging only works for Win32 processes, not x64 processes. 64-bit debugging will be enabled in the final product release.
C++ Conformance Roadmap
C++ has long been a mainstay of the computing industry, gaining significant adoption since it came on the scene in the early 1980s. Yet even with its rich history, it continues to evolve in meaningful ways, now on a faster cadence than we’ve seen in the past. In fact, this has already been a big year for C++. In April, less than two years after the ratification of C++11, the ISO C++ committee voted to adopt the feature set for the upcoming C++14 standard, which is expected to be done in the next year and which rounds out the C++11 standard with key features like generic lambdas.
We started on the path of C++11 support in Visual C++ with our Visual Studio 2010 release, in which we implemented several C++11 features, including auto and lambda functions. In Visual Studio 2012, we implemented more of the standard, with support for features like range-based for loops, standard threads, and futures. And this week we announced Visual Studio 2013 Preview, which as I noted in my blog post on the Preview earlier this week, provides more C++11 support, including capabilities like variadic templates and delegating constructors. However, as several of you have pointed out in comments on that post, we still have a ways to go in providing full support for C++11.
Today at his Build 2013 conference session on “The Future of C++”, Herb Sutter (an architect on our Visual C++ team and the convener of the ISO C++ standards committee) announced a roadmap for when Visual C++ would implement the complete feature set of the current ISO C++ standard. Because C++14 “completes C++11,” and because as of two months ago we now know C++14’s feature set, we consider draft C++14 to be the current target. I think a particular statement of Herb’s clarifies our approach nicely:
“Visual C++ is targeting C++14, so we’re treating all the new features in C++11 and C++14 as a single bucket of work to do. We’ll do all of the features, but we’ll work on them in the order that delivers the most value soonest to customers. That means we will implement all of C++11 and C++14, but some high-value C++14 features, such as generic lambdas, should come before others from C++11.”
We will share a more specific timeframe for full conformance as we work through the details, but the following slide from Herb’s talk presented what we know now, listing the features remaining to be added and the approximate order in which we expect them to appear.
There are six “buckets” of remaining language features which together will bring Visual C++ to be a full implementation of not only C++11 and C++14, but also the “C++14 wave” that includes three additional technical specifications also expected to be completed by the ISO C++ committee in the next year: a file system library based on Boost File System version 3 (the previous version 2 is already included in Visual C++ 2012), an initial networking library, and set of language extensions called “Concepts” that enable expressing template constraints and are important to improve template type-checking and deliver greatly improved diagnostics.
The first two buckets of features will be available in Visual C++ 2013 RTM later this year. Herb also announced that, in response to customer requests, the RTM version will also include a few tactical C99 language extensions when compiling C code, so that some popular community libraries (including FFmpeg) will now be able to compile with Visual C++ 2013.
Some subset of the next two buckets, which include some of the most highly anticipated C++14 features (such as generic lambdas and generalized lambda capture) are already being implemented in parallel with our work on Visual C++ 2013 and will ship in a CTP release soon after the Visual C++ 2013 RTM. This CTP will also include an implementation of the async/await feature Microsoft is proposing for the C++ standard; async/await has not only been the number one request from our C++/CX customers for WinRT programming, it is more generally wonderfully useful for any asynchronous code.
Herb also announced today the GoingNative conference, happening in a few months on September 4-6 on Microsoft’s campus in Redmond, WA. At that event, we will be able to share another progress update with more specific details on the timing and feature set of the upcoming CTP and related work announced in today’s roadmap. The GoingNative conference will include a keynote by Bjarne Stroustrup, the creator of C++, as well as talks by a “who’s who” of the C++ community and active standards committee members: Scott Meyers, Andrei Alexandrescu of Facebook, Chandler Carruth of Google, Stephan T. Lavavej of Microsoft, Sean Parent of Adobe, Michael Wong of IBM (who also represents Canada in ISO C++ and who is the current chairman of OpenMP), and more. Registration for the conference is now open.
We are delighted to see the continued momentum behind C++ across the industry, and we look forward to continuing to being a part of this important language and community. For more information and to discuss these efforts, please see the Visual C++ team blog.
Namaste!
Follow me on Twitter at http://twitter.com/ssomasegar.