將執行階段變更從 .NET Framework 4.6 移轉至 4.6.1Runtime Changes for Migration from .NET Framework 4.6 to 4.6.1

如果您想從 .NET Framework 4.6 移轉至 4.6.1,請檢閱下列主題中可能會影響應用程式的應用程式相容性問題:If you are migrating from the .NET Framework 4.6 to 4.6.1, review the following topics for application compatibility issues that may affect your app:

工具Tools

Contract.Invariant 或 Contract.Requires<TException> 不會將 String.IsNullOrEmpty 視為 pureContract.Invariant or Contract.Requires<TException> do not consider String.IsNullOrEmpty to be pure

詳細資料Details

針對以 .NET Framework 4.6.1 為目標的應用程式,如果的非變異合約 Contract.Invariant 或呼叫方法的前置條件合約 Requires ,重寫器 String.IsNullOrEmpty 會發出編譯器警告 CC1036:偵測 " 到方法 ' System.string. IsNullOrWhiteSpace (system.string) ' 的呼叫,但方法中沒有 [純]。 " 這是編譯器警告,而不是編譯器錯誤。For apps that target the .NET Framework 4.6.1, if the invariant contract for Contract.Invariant or the precondition contract for Requires calls the String.IsNullOrEmpty method, the rewriter emits compiler warning CC1036: "Detected call to method 'System.String.IsNullOrWhiteSpace(System.String)' without [Pure] in method." This is a compiler warning rather than a compiler error.

建議Suggestion

GitHub 問題 #339 中已解決這種行為。This behavior was addressed in GitHub Issue #339. 若要移除這個警告,您可以從 GitHub 下載並編譯程式碼合約工具原始程式碼的更新版本。To eliminate this warning, you can download and compile an updated version of the source code for the Code Contracts tool from GitHub. 您可以在頁面底部找到下載資訊。Download information is found at the bottom of the page.

名稱Name Value
範圍Scope MinorMinor
版本Version 4.6.14.6.1
類型Type 執行階段Runtime

受影響的 APIAffected APIs

Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)

在具有不同像素高度之項目的簡單列表中進行項目捲動Item-scrolling a flat list with items of different pixel-height

詳細資料Details

System.Windows.Controls.ItemsControl 使用虛擬化 (IsVirtualizing=true) 及項目捲動 (ScrollUnit=Item) 顯示集合時,以及捲動控制項以顯示高度 (以像素為單位) 與其相鄰項目不同的項目時,System.Windows.Controls.VirtualizingStackPanel 會逐一查看集合中的所有項目。When an System.Windows.Controls.ItemsControl displays a collection using virtualization (IsVirtualizing=true) and item- scrolling (ScrollUnit=Item), and when the control scrolls to display an item whose height in pixels differs from its neighbors, the System.Windows.Controls.VirtualizingStackPanel iterates over all items in the collection. UI 在此反覆運算期間沒有回應;如果集合很大,這可視為停止回應。The UI is unresponsive during this iteration; if the collection is large, this can be perceived as a hang. 即使在先前的 .NET Framework 版本中,也會在其他情況下進行反復專案。The iteration occurs in other circumstances, even in previous .NET Framework releases. 例如,在下列情況會發生這種情況:如果在發現像素高度不同的項目時進行像素捲動 (ScrollUnit=Pixel),以及如果在發現子系項目數與其相鄰項目不同的項目時進行階層式資料項目捲動 (例如,在已啟用群組的 System.Windows.Controls.TreeViewSystem.Windows.Controls.ItemsControl 中)。針對項目捲動和不同像素高度的情況,.NET Framework 4.6.1 中引進了逐一查看,以修正階層式資料配置中的 Bug。For example, it occurs when pixel-scrolling (ScrollUnit=Pixel) upon encountering an item with different pixel height, and when item-scrolling hierarchical data (such as a System.Windows.Controls.TreeView or an System.Windows.Controls.ItemsControl with grouping enabled) upon encountering an item with a different number of descendant items than its neighbors.For the case of item-scrolling and different pixel height, the iteration was introduced in .NET Framework 4.6.1 to fix bugs in the layout of hierarchical data. 如果是單層式資料 (沒有階層),則不需要逐一查看,而且 .NET Framework 4.6.2 在此情況下不會這麼做。It is not needed if the data is flat (no hierarchy), and .NET Framework 4.6.2 does not do it in that case.

建議Suggestion

如果在 .NET Framework 4.6.1 中出現逐一查看行為,但舊版本中並未出現 (亦即,如果 System.Windows.Controls.ItemsControl 是在具有不同像素高度之項目的簡單列表中進行項目捲動),則有兩種解決方式:If the iteration occurs in .NET Framework 4.6.1 but not in earlier releases - that is, if the System.Windows.Controls.ItemsControl is item- scrolling a flat list with items of different pixel height - there are two remedies:

  1. 安裝 .NET Framework 4.6.2。Install .NET Framework 4.6.2.
  2. 安裝 .NET Framework 4.6.1 的 Hotfix HR 1605。Install hotfix HR 1605 for .NET Framework 4.6.1.

名稱Name Value
範圍Scope MinorMinor
版本Version 4.6.14.6.1
類型Type 執行階段Runtime

受影響的 APIAffected APIs

WPF 拼字檢查功能所擲回的 ObjectDisposedExceptionObjectDisposedException thrown by WPF spellchecker

詳細資料Details

在應用程式關閉期間,WPF 應用程式偶爾會因拼字檢查功能所擲回的 System.ObjectDisposedException 而損毀。WPF applications occasionally crash during application shutdown with an System.ObjectDisposedException thrown by the spellchecker. 此問題已在 .NET Framework 4.7 WPF 中透過依正常程序處理例外狀況來修正,進而確保應用程式不會再受到負面影響。This is fixed in .NET Framework 4.7 WPF by handling the exception gracefully, and thus ensuring that applications are no longer adversely affected. 請注意,在偵錯工具下執行的應用程式偶爾還是會發生第一個例外狀況。It should be noted that occasional first-chance exceptions would continue to be observed in applications running under a debugger.

建議Suggestion

升級至 .NET Framework 4.7Upgrade to .NET Framework 4.7

名稱Name Value
範圍Scope EdgeEdge
版本Version 4.6.14.6.1
類型Type 執行階段Runtime

受影響的 APIAffected APIs

無法透過 API 分析偵測。Not detectable via API analysis.

WPF 拼字檢查以非預期的方式失敗WPF Spell Checking fails in unexpected ways

詳細資料Details

這包括一些 WPF 拼字檢查工具問題:This includes a number of WPF Spell Checker issues:

建議Suggestion

問題 #1 - 此問題已在 .NET Framework 4.6.2 中修正。問題 #2 - 使用 [以不同的使用者身分執行] 來啟動應用程式時,不再支援 WPF 拼字檢查工具。Issue #1 - This has been fixed in .NET Framework 4.6.2 Issue #2 - WPF Spell Checker is no longer supported when applications are launched using 'run as different user'. 從 .NET Framework 4.6.2 開始,以這種方式啟動的應用程式將不會再意外損毀 - 而是以無訊息的方式停用拼字檢查工具。Starting .NET Framework 4.6.2, applications launched in this manner will no longer crash unexpectedly - instead the Spell Checker will be silently disabled. 問題 #3 - 此問題已在 .NET Framework 4.6.2 中修正。Issue #3 - This has been fixed in .NET Framework 4.6.2.

名稱Name Value
範圍Scope EdgeEdge
版本Version 4.6.14.6.1
類型Type 執行階段Runtime

受影響的 APIAffected APIs

無法透過 API 分析偵測。Not detectable via API analysis.