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%的速度-提升 代碼運行的速度會更快吧


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM