都内で働くSEの技術的なひとりごと

都内でサラリーマンやってます。マイクロソフト系(たまに、OSS系などマイクロソフト以外の技術も...)の技術的なことについて書いています。日々の仕事の中で、気になったことを技術要素関係なく気まぐれに選んでいるので記事内容は開発言語、インフラ等ばらばらです。なお、当ブログで発信、発言は私個人のものであり、所属する組織、企業、団体等とは何のかかわりもございません。ブログの内容もきちんと検証して使用してください。よろしくお願いします♪

.NET Framework 4.5.1 Preview の記事の続きを書いてみる

 この記事の続きを少し。.NET Framework 4.5.1 Preview + Visual Studio 2013 Preview で x64 上での エディット & コンティニューが可能になったんですね。今までは、x64 上のOSでエディット & コンティニューしようとすると、『64 ビット アプリケーションへの変更は許可されてない』と警告がでました。これを回避するには、プロジェクトのプロパティを、『x86』に変更する必要がありました。クライアントも含めて64 ビット化が進んできている現状を考えると、当然の機能といえます。(投票数も多いですね。)

x64 Edit and Continue

Uservoice feature completed: x64 edit and continue (2600+ votes)

clip_image001

Image attribution

We now have x64 Edit and Continue (EnC) available in Visual Studio 2013 Preview. We’ve wanted to add that feature for a long time, but we always had at least two other features ahead of it in our priority list. This time, we decided that it really needed to get done and didn’t bother with any of the priority lists. That, of course, leads us to our fun celebratory image. It’s certainly a good description of how we feel about this feature.

x64 EnC doesn’t need a lot of explanation. We’ve had x86 EnC in the product since the Visual Studio 2005/.NET Framework 2.0 release, and we're sure all you have used this feature and that many of you rely on it daily. With Visual Studio 2013 Preview, you can now use EnC with x64, AnyCPU, and (of course) x86 projects.

 

 戻り値に関しても改善されたようですね。デバッキング中に、戻り値を参照したいために、不必要なコード変更をしなくても、Autos 画面にちゃんと変数の内容を表示可能になりました。また、イミディエイトウィンドウ ( Visual Basic 6.0 を思い出す... )に$ReturnValue と入力すると、戻り値を表示されることができます。まだまだ、改善はされそうな雰囲気です。

Managed return value inspection

Uservoice feature completed: Function return value in debugger (1096 votes)

How many times have you written a method that included a return statement of a method call or called a method that evaluated expressions as arguments? It is pleasant and tempting to write code like that. It might look like this. 

public Task<HttpResponseMessage> GetDotNetTeamRSS()
        {
            var server = ControllerContext.Request.RequestUri.GetLeftPart(UriPartial.Scheme | UriPartial.Authority);
            var client = new HttpClient();
            return client.GetAsync(server + "/api/httpproxy?url=" + server + "/api/rss");
        }

Unfortunately, that code can be difficult to debug, since the debugger will not show you the final return value. In the worst case, you may find that the return value is immediately returned from the caller, requiring you to travel back a few frames to get the value you want. Instead, you may sometimes store these values as locals to ensure a better debugging experience later. In that case, the code above would look like the following:

public Task<HttpResponseMessage> GetDotNetTeamRSS()
        {
            var server = ControllerContext.Request.RequestUri.GetLeftPart(UriPartial.Scheme | UriPartial.Authority);
            var client = new HttpClient();
            var message = client.GetAsync(server + "/api/httpproxy?url=" + server + "/api/rss");
            return message;
        }

We’ve all evaluated this trade-off many times and sided on both sides of it.

Fortunately, we’ve erased this trade-off in Visual Studio 2013 Preview. Going forward, you can write your code any way you want, and consult the Autos Window for return values.

You’ll see a new symbol in the Autos Window that displays return values, as illustrated below. This new feature displays both direct return values and the values of embedded methods (the arguments). This is similar to the existing Visual C++ version of this feature, which we consulted as part of our design effort.

clip_image008

Different people use the debugger in different ways, in addition to having different coding styles. The visual representation that you see in Autos may be the perfect solution for many of you, but others may want to use the Watch window or the Immediate window, which provide different ways of interacting with the debugger. In both cases, you can use the new $ReturnValue keyword to inspect managed return values.

clip_image009

In this release, $ReturnValue represents just the direct return value and not any of the embedded return values. Please tell us in the comments or on uservoice if you feel that we should extend the feature to enable the same level of expressiveness for Immediate and Watch windows as you get with the Autos.

 

 これ地味だけど、良い機能です。インテリセンスがコメントを表示するんですね。

Windows Store app development

(中略)

Another change is with structs. Nullable fields are now supported on structs defined in Windows Runtime components. You have the expected experience accessing those fields from .NET code and you can define a struct with a Nullable field when exporting a managed Windows Runtime component.

We added support so Intellisense can pick up on doc comments across language boundaries when a type projection occurs (e.g. IList<int> <-> IVector<int>). Here is an example of a doc comment on a managed method which has a projected type parameter.

 /// <summary>
 /// MyMethod has a summary
 /// </summary>
 /// <param name="myInts">Give me all your numbers</param>
 public void MyMethod(IList<int> myInts)
 {
 // do useful work
 }

On Windows 8.1 Preview with Visual Studio 2013 Preview, Intellisense will show these doc comments when you try to use this method from another language projection.clip_image004[1]

 .NET Framework の全体パフォーマンス向上、LOH の改善によるリソース使用の最適化などに加えて、上記のような開発効率向上の改善等も含まれており、4.5 → 4.5.1 のバージョンアップとは思えない大幅な改善です。今後もこのような良改善を期待しています。