Vs2013 & .net framework 4.5.1 预览介绍

微软发布了vs2013 preview 和fw4.5.1 下面简单介绍一下与大家共享

Developer productivity
  • X64 edit and continue 在2013里面 可以在x64, AnyCPU下面进行修改并及时编译来调试了。
  • Async-aware debugging 2013里面 堆栈调用窗口有了很大改进 会显示更多的调用逻辑信息

image

  • 新加入一个Tasks窗口用来显示并行任务信息

image

  • Managed return value inspection 函数返回值的校验
    • 在以往的vs中如果一个函数的返回值来源于一个或多个函数的返回值,你可能会写出如下代码
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");
        }
    • 上面代码段如果你想验证返回值的时候就比较麻烦了,在以往可能需要这样
      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;
        }

       新建一个临时变量存储返回值,以便于调试。but 在vs2013里面 我们可以这样

image

一个新的断点符号 并且在提示窗口中可以查看直接调用的函数的返回值 攒一下~,你以为这样就结束了么No~

在及时窗口中 你还可以通过$ReturnValue 来查看返回值

image

  • ADO.NET idle connection resiliency  ADO的 弹性连接控制

类似pc休眠与唤醒的功能,能够断开会话状态并在适当的时候恢复会话,很多场景都会收益于这个功能

  • Improvements in Windows Store app development

        貌似增加了一个IRandomAccessStream接口 可以干一些异步流加载绑定的事情,不是很明白应用场景,上代码

   //access image via networking i/o
                    var imageUrl = "http://www.microsoft.com/global/en-us/news/publishingimages/logos/MSFT_logo_Web.jpg";
                    var client = new HttpClient();
                    Stream stream = await client.GetStreamAsync(imageUrl);
                    var memStream = new MemoryStream();
                    await stream.CopyToAsync(memStream);
                    memStream.Position = 0;
                    var bitmap = new BitmapImage();
                    bitmap.SetSource(memStream.AsRandomAccessStream());
                    image.Source = bitmap;

读取网络资源绑定

//access image via file i/o
                    var imagePath = "picture.png";
                    StorageFolder folder = KnownFolders.PicturesLibrary;
                    StorageFile file = await folder.GetFileAsync(imagePath);
                    var bitmap = new BitmapImage();
                    Stream stream = await file.OpenStreamForWriteAsync();
                    // this is the point where you operate on the stream with .NET code
                    // imaging applying an image transform
                    bitmap.SetSource(stream.AsRandomAccessStream());
                    image.Source = bitmap;

读取本地资源绑定

但是下面这个改进还是不错的

在vs2013里面调试信息变得更人性化了

image

原来你可能不能很直接的看到错误信息 现在

image

直接就可以看到了 不错。

并且在2013中 智能提示可以自动跨语言投影提示了

image

image

Application performance 应用程序性能

在意外.net 一直被诟病在性能上没有优势于是在fw4.5.1里面 他们有了一些影响深刻的改进

  • ASP.NET app suspension 
    • 新的low-latency and high-density的解决方案。类似于android的多任务的形式,我们可以把一个暂时闲置的网站挂起在iis中 缓存到磁盘中 释放cpu请求和内存。在有请求的时候他又能够快速的被唤醒。我们称之为IIS Idle Worker Process Page-out。当某个站点在设定的时间内没有访问的时候就可以把它缓存起来通过Windows Virtual Memory Manager。一旦启用的特性在IIS,ASP将会使用它,不需要任何额外的配置。在实验室中貌似可以多部署7倍的asp网站,并可以提升90%的启动时间,这一切惟一更改是配置Windows页面文件位于一个固态硬盘。悬挂使暂停网站启动非常快,但要求网站已经运行至少一次,才得以进入该状态。
    • image
  • On-demand large object heap compaction
    • 根据请求的大对象压缩 。 更好的利用空闲内存在大对象堆中,并优化了GC算法
  • Multi-core JIT improvements 多核及时编译改进,支持动态加载程序集,有15%的速度-提升 代码运行的速度会更快吧
原文地址:https://www.cnblogs.com/aoldman/p/3158197.html