Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article lists the app compatibility issues that were introduced in .NET Framework 4.7, 4.7.1, and 4.7.2.
In the .NET Framework 4.6.2, the runtime throws a T:System.NullReferenceException
when retrieving a P:System.Web.HttpRuntime.AppDomainAppPath
value that includes null characters.In the .NET Framework 4.6.1 and earlier versions, the runtime throws an T:System.ArgumentNullException
.
You can do either of the follow to respond to this change:
T:System.NullReferenceException
if you application is running on the .NET Framework 4.6.2.T:System.ArgumentNullException
.Name | Value |
---|---|
Scope | Edge |
Version | 4.6.2 |
Type | Retargeting |
In the .NET Framework 4.6.2 and earlier, ASP.NET executes requests with the same Sessionid sequentially, and ASP.NET always issues the Sessionid through cookies by default. If a page takes a long time to respond, it will significantly degrade server performance just by pressing F5 on the browser. In the fix, we added a counter to track the queued requests and terminate the requests when they exceed a specified limit. The default value is 50. If the limit is reached, a warning will be logged in the event log, and an HTTP 500 response may be recorded in the IIS log.
To restore the old behavior, you can add the following setting to your web.config file to opt out of the new behavior.
<appSettings>
<add key="aspnet:RequestQueueLimitPerSession" value="2147483647"/>
</appSettings>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7 |
Type | Retargeting |
Starting with apps that target the .NET Framework 4.7, the default value of the ServicePointManager.SecurityProtocol property is SecurityProtocolType.SystemDefault. This change allows .NET Framework networking APIs based on SslStream (such as FTP, HTTPS, and SMTP) to inherit the default security protocols from the operating system instead of using hard-coded values defined by the .NET Framework. The default varies by operating system and any custom configuration performed by the system administrator. For information on the default SChannel protocol in each version of the Windows operating system, see Protocols in TLS/SSL (Schannel SSP).
For applications that target an earlier version of the .NET Framework, the default value of the ServicePointManager.SecurityProtocol property depends on the version of the .NET Framework targeted. See the Networking section of Retargeting Changes for Migration from .NET Framework 4.5.2 to 4.6 for more information.This change affects applications that target the .NET Framework 4.7 or later versions. If you prefer to use a defined protocol rather than relying on the system default, you can explicitly set the value of the ServicePointManager.SecurityProtocol property. If this change is undesirable, you can opt out of it by adding a configuration setting to the <runtime> section of your application configuration file. The following example shows both the <runtime>
section and the Switch.System.Net.DontEnableSystemDefaultTlsVersions
opt-out switch:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSystemDefaultTlsVersions=true" />
</runtime>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7 |
Type | Retargeting |
After a failed TLS handshake, an System.IO.IOException with an inner System.ComponentModel.Win32Exception exception will be thrown by the first I/O Read/Write operation. The System.ComponentModel.Win32Exception.NativeErrorCode code for the System.ComponentModel.Win32Exception can be mapped to the TLS Alert from the remote party using the Schannel error codes for TLS and SSL alerts.For more information, see RFC 2246: Section 7.2.2 Error alerts.
The behavior in .NET Framework 4.6.2 and earlier is that the transport channel (usually TCP connection) will timeout during either Write or Read if the other party failed the handshake and immediately afterwards rejected the connection.
Applications calling network I/O APIs such as Read(Byte[], Int32, Int32)/Write(Byte[], Int32, Int32) should handle IOException or System.TimeoutException.
The TLS Alerts feature is enabled by default starting with .NET Framework 4.7. Applications targeting versions of the .NET Framework from 4.0 through 4.6.2 running on a .NET Framework 4.7 or higher system will have the feature disabled to preserve compatibility.
The following configuration API is available to enable or disable the feature for .NET Framework 4.6 and later applications running on .NET Framework 4.7 or later.
Programmatically: Must be the very first thing the application does since ServicePointManager will initialize only once:
AppContext.SetSwitch("TestSwitch.LocalAppContext.DisableCaching", true);
// Set to 'false' to enable the feature in .NET Framework 4.6 - 4.6.2.
AppContext.SetSwitch("Switch.System.Net.DontEnableTlsAlerts", true);
AppConfig:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableTlsAlerts=true"/>
<!-- Set to 'false' to enable the feature in .NET Framework 4.6 - 4.6.2. -->
</runtime>
Registry key (machine global):
Set the Value to false
to enable the feature in .NET Framework 4.6 - 4.6.2.
Key: HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\AppContext\Switch.System.Net.DontEnableTlsAlerts
- Type: String
- Value: "true"
Name | Value |
---|---|
Scope | Edge |
Version | 4.7 |
Type | Retargeting |
The ParentWindowHandle value, introduced in .NET Framework 2.0, allows an application to register a parent window handle value such that any UI required to access the key (such as a PIN prompt or consent dialog) opens as a modal child to the specified window.Starting with apps that target the .NET Framework 4.7, a Windows Forms application can set the ParentWindowHandle property with code like the following:
cspParameters.ParentWindowHandle = form.Handle;
In previous versions of the .NET Framework, the value was expected to be an System.IntPtr representing a location in memory where the HWND value resided. Setting the property to form.Handle on Windows 7 and earlier versions had no effect, but on Windows 8 and later versions, it results in a "System.Security.Cryptography.CryptographicException: The parameter is incorrect."
Applications targeting .NET Framework 4.7 or higher wishing to register a parent window relationship are encouraged to use the simplified form:
cspParameters.ParentWindowHandle = form.Handle;
Users who had identified that the correct value to pass was the address of a memory location which held the value form.Handle
can opt out of the behavior change by setting the AppContext switch Switch.System.Security.Cryptography.DoNotAddrOfCspParentWindowHandle
to true
:
<runtime>
section of the app.config file:<runtime>
<AppContextSwitchOverrides value="Switch.System.Security.Cryptography.DoNotAddrOfCspParentWindowHandle=true"/>
</runtime>
Conversely, users who wish to opt in to the new behavior on the .NET Framework 4.7 runtime when the application loads under older .NET Framework versions can set the AppContext switch to false
.
Name | Value |
---|---|
Scope | Minor |
Version | 4.7 |
Type | Retargeting |
After a failed TLS handshake, an System.IO.IOException with an inner System.ComponentModel.Win32Exception exception will be thrown by the first I/O Read/Write operation. The System.ComponentModel.Win32Exception.NativeErrorCode code for the System.ComponentModel.Win32Exception can be mapped to the TLS Alert from the remote party using the Schannel error codes for TLS and SSL alerts.For more information, see RFC 2246: Section 7.2.2 Error alerts.
The behavior in .NET Framework 4.6.2 and earlier is that the transport channel (usually TCP connection) will timeout during either Write or Read if the other party failed the handshake and immediately afterwards rejected the connection.
Applications calling network I/O APIs such as Read(Byte[], Int32, Int32)/Write(Byte[], Int32, Int32) should handle IOException or System.TimeoutException.
The TLS Alerts feature is enabled by default starting with .NET Framework 4.7. Applications targeting versions of the .NET Framework from 4.0 through 4.6.2 running on a .NET Framework 4.7 or higher system will have the feature disabled to preserve compatibility.
The following configuration API is available to enable or disable the feature for .NET Framework 4.6 and later applications running on .NET Framework 4.7 or later.
Programmatically: Must be the very first thing the application does since ServicePointManager will initialize only once:
AppContext.SetSwitch("TestSwitch.LocalAppContext.DisableCaching", true);
// Set to 'false' to enable the feature in .NET Framework 4.6 - 4.6.2.
AppContext.SetSwitch("Switch.System.Net.DontEnableTlsAlerts", true);
AppConfig:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableTlsAlerts=true"/>
<!-- Set to 'false' to enable the feature in .NET Framework 4.6 - 4.6.2. -->
</runtime>
Registry key (machine global):
Set the Value to false
to enable the feature in .NET Framework 4.6 - 4.6.2.
Key: HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\AppContext\Switch.System.Net.DontEnableTlsAlerts
- Type: String
- Value: "true"
Name | Value |
---|---|
Scope | Edge |
Version | 4.7 |
Type | Retargeting |
In .NET Framework 4.6.2 and earlier versions, the System.Runtime.Serialization.Json.DataContractJsonSerializer did not serialize some special control characters, such as \b, \f, and \t, in a way that was compatible with the ECMAScript V6 and V8 standards. Starting with .NET Framework 4.7, serialization of these control characters is compatible with ECMAScript V6 and V8.
For apps that target the .NET Framework 4.7, this feature is enabled by default. If this behavior is not desirable, you can opt out of this feature by adding the following line to the <runtime>
section of the app.config or web.config file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Runtime.Serialization.DoNotUseECMAScriptV6EscapeControlCharacter=false" />
</runtime>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7 |
Type | Retargeting |
Starting in the .NET Framework 4.7, customers can configure either TLS1.1 or TLS1.2 in WCF message security in addition to SSL3.0 and TLS1.0 through application configuration settings.
In the .NET Framework 4.7, support for TLS1.1 and TLS1.2 in WCF message security is disabled by default. You can enable it by adding the following line to the <runtime>
section of the app.config or web.config file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.ServiceModel.DisableUsingServicePointManagerSecurityProtocols=false;Switch.System.Net.DontEnableSchUseStrongCrypto=false" />
</runtime>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7 |
Type | Retargeting |
Under some circumstances, calls to the internal System.Windows.Intput.PenContext.Disable method on touch-enabled systems may throw an unhandled T:System.ArgumentException
because of reentrancy.
This issue has been addressed in the .NET Framework 4.7. To prevent the exception, upgrade to a version of the .NET Framework starting with the .NET Framework 4.7.
Name | Value |
---|---|
Scope | Edge |
Version | 4.6.1 |
Type | Retargeting |
An error in the exception handling code for ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) caused an incorrect System.NullReferenceException to be thrown instead of the intended exception ( System.IO.DirectoryNotFoundException or System.IO.FileNotFoundException). This change corrects that error so that the method now throws the right exception.
By default all applications targeting .NET Framework 4.6.2 and earlier continue to throw System.NullReferenceException for compatibility. Developers targeting .NET Framework 4.7 and above should see the right exceptions.
Developers who wish to revert to getting System.NullReferenceException when targeting .NET Framework 4.7 or later can add/merge the following to their application's App.config file:
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Media.ImageSourceConverter.OverrideExceptionWithNullReferenceException=true"/>
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7 |
Type | Retargeting |
Starting with .NET Framework 4.7, WPF replaces the algorithm that Grid uses to allocate space to *-columns. This will change the actual width assigned to *-columns in a number of cases:
The new algorithm fixes several bugs present in the old algorithm:
Total allocation to columns can exceed the Grid's width. This can occur when allocating space to a column whose proportional share is less than its minimum size. The algorithm allocates the minimum size, which decreases the space available to other columns. If there are no *-columns left to allocate, the total allocation will be too large.
Total allocation can fall short of the Grid's width. This is the dual problem to #1, arising when allocating to a column whose proportional share is greater than its maximum size, with no *-columns left to take up the slack.
Two *-columns can receive allocations not proportional to their *-weights. This is a milder version of #1/#2, arising when allocating to *-columns A, B, and C (in that order), where B's proportional share violates its min (or max) constraint. As above, this changes the space available to column C, who gets less (or more) proportional allocation than A did.
Columns with extremely large weights (> 10^298) are all treated as if they had weight 10^298. Proportional differences between them (and between columns with slightly smaller weights) are not honored.
Columns with infinite weights are not handled correctly. (Actually you can't set a weight to Infinity, but this is an artificial restriction. The allocation code was trying to handle it, but doing a bad job.)
Several minor problems while avoiding overflow, underflow, loss of precision, and similar floating-point issues.
Adjustments for layout rounding are incorrect at sufficiently high DPI. The new algorithm produces results that meet the following criteria:
Note
Everything said about columns and widths in this article applies to rows and heights as well.
By default, apps that target versions of the .NET Framework starting with the .NET Framework 4.7 will see the new algorithm, while apps that target the .NET Framework 4.6.2 or earlier versions will see the old algorithm.
To override the default, use the following configuration setting:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Controls.Grid.StarDefinitionsCanExceedAvailableSpace=true" />
</runtime>
The value true
selects the old algorithm, false
selects the new algorithm.
Name | Value |
---|---|
Scope | Minor |
Version | 4.7 |
Type | Retargeting |
This change adds the ability to enable an optional WM_POINTER based WPF touch/stylus stack. Developers that do not explicitly enable this should see no change in WPF touch/stylus behavior.Current Known Issues With optional WM_POINTER based touch/stylus stack:
Developers who wish to enable this stack can add/merge the following to their application's App.config file:
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Input.Stylus.EnablePointerSupport=true"/>
</runtime>
</configuration>
Removing this or setting the value to false will turn this optional stack off.Note that this stack is available only on Windows 10 Creators Update and above.
Name | Value |
---|---|
Scope | Edge |
Version | 4.7 |
Type | Retargeting |
To support debugging with Visual Studio, the Workflow runtime generates a checksum for a workflow instance using a hashing algorithm. In the .NET Framework 4.6.2 and earlier versions, workflow checksum hashing used the MD5 algorithm, which caused issues on FIPS-enabled systems. Starting with the .NET Framework 4.7, the algorithm is SHA1. If your code has persisted these checksums, they will be incompatible.
If your code is unable to load workflow instances due to a checksum failure, try setting the AppContext
switch "Switch.System.Activities.UseMD5ForWFDebugger" to true.In code:
System.AppContext.SetSwitch("Switch.System.Activities.UseMD5ForWFDebugger", true);
Or in configuration:
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Activities.UseMD5ForWFDebugger=true" />
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7 |
Type | Retargeting |
Starting with the .NET Framework 4.7.1, ASP.NET has improved how ASP.NET Web Controls work with accessibility technology in Visual Studio to better support ASP.NET customers. These include the following changes:
How to opt in or out of these changes In order for the Visual Studio Designer to benefit from these changes, it must run on the .NET Framework 4.7.1 or later. The web application can benefit from these changes in either of the following ways:
Switch.UseLegacyAccessibilityFeatures
AppContext switch to the <runtime>
section in the devenv.exe.config file and setting it to false
, as the following example shows.<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
...
<!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true/false;key2=true/false' -->
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false" />
...
</runtime>
</configuration>
Applications that target the .NET Framework 4.7.1 or later and want to preserve the legacy accessibility behavior can opt in to the use of legacy accessibility features by explicitly setting this AppContext switch to true
.
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.1 |
Type | Retargeting |
Background threads created with SerialPort streams no longer terminate the process when OS exceptions are thrown.
In applications that target the .NET Framework 4.7 and earlier versions, a process is terminated when an operating system exception is thrown on a background thread created with a SerialPort stream.
In applications that target the .NET Framework 4.7.1 or a later version, background threads wait for OS events related to the active serial port and could crash in some cases, such as sudden removal of the serial port.
For apps that target the .NET Framework 4.7.1, you can opt out of the exception handling if it is not desirable by adding the following to the <runtime>
section of your app.config
file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.Ports.DoNotCatchSerialStreamThreadExceptions=true" />
</runtime>
For apps that target earlier versions of the .NET Framework but run on the .NET Framework 4.7.1 or later, you can opt in to the exception handling by adding the following to the <runtime>
section of your app.config
file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.Ports.DoNotCatchSerialStreamThreadExceptions=false" />
</runtime>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.1 |
Type | Retargeting |
In the .NET Framework 4.7 and earlier versions, exceptions thrown on service startup are not propagated to the caller of ServiceBase.Run.
Starting with applications that target the .NET Framework 4.7.1, the runtime propagates exceptions to ServiceBase.Run for services that fail to start.
On service start, if there is an exception, that exception will be propagated. This should help diagnose cases where services fail to start.
If this behavior is undesirable, you can opt out of it by adding the following AppContextSwitchOverrides
element to the runtime
section of your application configuration file:
<AppContextSwitchOverrides value="Switch.System.ServiceProcess.DontThrowExceptionsOnStart=true" />
If your application targets an earlier version than 4.7.1 but you want to have this behavior, add the following AppContextSwitchOverrides
element to the runtime
section of your application configuration file:
<AppContextSwitchOverrides value="Switch.System.ServiceProcess.DontThrowExceptionsOnStart=false" />
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.1 |
Type | Retargeting |
In the .NET Framework 4.7 and earlier, SignedXML and SignedCMS default to SHA1 for some operations.Starting with the .NET Framework 4.7.1, SHA256 is enabled by default for these operations. This change is necessary because SHA1 is no longer considered to be secure.
There are two new context switch values to control whether SHA1 (insecure) or SHA256 is used by default:
<AppContextSwitchOverrides value="Switch.System.Security.Cryptography.Xml.UseInsecureHashAlgorithms=true;Switch.System.Security.Cryptography.Pkcs.UseInsecureHashAlgorithms=true" />
For applications that target the .NET Framework 4.7 and earlier versions, you can opt into this change by adding the following configuration switch to the runtime section of your app config file:
<AppContextSwitchOverrides value="Switch.System.Security.Cryptography.Xml.UseInsecureHashAlgorithms=false;Switch.System.Security.Cryptography.Pkcs.UseInsecureHashAlgorithms=false" />
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.1 |
Type | Retargeting |
Starting with the .NET Framework 4.6.2, the concrete type of the object returned by the SignedXml.GetPublicKey method changed (without a quirk) from a CryptoServiceProvider implementation to a Cng implementation. This is because the implementation changed from using certificate.PublicKey.Key
to using the internal certificate.GetAnyPublicKey
which forwards to RSACertificateExtensions.GetRSAPublicKey.
Starting with apps running on the .NET Framework 4.7.1, you can use the CryptoServiceProvider implementation used by default in the .NET Framework 4.6.1 and earlier versions by adding the following configuration switch to the runtime section of your app config file:
<AppContextSwitchOverrides value="Switch.System.Security.Cryptography.Xml.SignedXmlUseLegacyCertificatePrivateKey=true" />
Name | Value |
---|---|
Scope | Edge |
Version | 4.6.2 |
Type | Retargeting |
In the .NET Framework SDK 4.7.1, the SvcConfigEditor.exe and SvcTraceViewer.exe tools have been improved by fixing varied accessibility issues. Most of these were small issues like a name not being defined or certain UI automation patterns not being implemented correctly. While many users wouldn't be aware of these incorrect values, customers who use assistive technologies like screen readers will find these SDK tools more accessible. Certainly, these fixes change some previous behaviors, like keyboard focus order.In order to get all the accessibility fixes in these tools, you can the following to your app.config file:
<runtime>
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false"/>
</runtime>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.1 |
Type | Retargeting |
Windows Forms is improving how it works with accessibility technologies to better support Windows Forms customers. These include the following changes starting with the .NET Framework 4.7.1:
How to opt in or out of these changes In order for the application to benefit from these changes, it must run on the .NET Framework 4.7.1 or later. The application can benefit from these changes in either of the following ways:
<runtime>
section of the app.config file and setting it to false
, as the following example shows.<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
</startup>
<runtime>
<!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true/false;key2=true/false -->
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false" />
</runtime>
</configuration>
Applications that target the .NET Framework 4.7.1 or later and want to preserve the legacy accessibility behavior can opt in to the use of legacy accessibility features by explicitly setting this AppContext switch to true
.
For an overview of UI automation, see the UI Automation Overview.
Added support for UI Automation patterns and properties
Accessibility clients can take advantage of new WinForms accessibility functionality by using common, publicly described invocation patterns. These patterns are not WinForms-specific. For instance, accessibility clients can call the QueryInterface method on the IAccessible interface (MAAS) to obtain an IServiceProvider interface. If this interface is available, clients can use its QueryService method to request an IAccessibleEx interface. For more information, see Using IAccessibleEx from a Client. Starting with the .NET Framework 4.7.1, IServiceProvider and IAccessibleEx (where applicable) are available for WinForms accessibility objects.
.NET Framework 4.7.1 adds support for the following UI automation patterns and properties:
The ToolStripSplitButton and ComboBox controls support the Expand/Collapse pattern.
The ToolStripMenuItem control has a ControlType property value ControlType.MenuItem.
The ToolStripItem control supports the NameProperty property and theExpand/Collapse pattern.
The ToolStripDropDownItem control supports AccessibleEvents indicating StateChange and NameChange when drop down is expanded or collapsed.
The ToolStripDropDownButton control has a ControlType property value of ControlType.MenuItem.
The DataGridViewCheckBoxCell control supports the TogglePattern.
The NumericUpDown and DomainUpDown controls support the NameProperty property and have a ControlType of ControlType.Spinner.
Improvements to the PropertyGrid control The .NET Framework 4.7.1 adds the following improvements to the PropertyBrowser control:The Details button in the error dialog that is displayed when the user enters an incorrect value in the PropertyGrid control supports the Expand/Collapse pattern, state and name change notifications, and a ControlType property with a value of ControlType.MenuItem.
The message pane displayed when the Details button of the error dialog is expanded is now keyboard accessible and allows Narrator to announce the content of the error message.
The AccessibleRole of rows in the PropertyGrid control have changed from "Row" to "Cell". The cell maps to UIA ControlType "DataItem", which allows it to support appropriate keyboard shortcuts and Narrator announcements.
The PropertyGrid control rows that represent header items when the PropertyGrid control has a PropertySort property set to PropertySort.Categorized have a ControlType property value of ControlType.Button.
The PropertyGrid control rows that represent header items when the PropertyGrid control has a PropertySort property set to PropertySort.Categorized support the Expand/Collapse pattern.
Improved keyboard navigation between the grid and the ToolBar above it. Pressing "Shift-Tab" now selects the first ToolBar button, instead of the whole ToolBar.
PropertyGrid controls displayed in High Contrast mode will now draw a focus rectangle around the ToolBar button which corresponds to the current PropertySort property value.
PropertyGrid controls displayed in High Contrast mode and with a PropertySort property set to PropertySort.Categorized will now display the background of category headers in a highly contrasting color.
PropertyGrid controls better differentiates between ToolBar items with focus and the ToolBar items which indicate the current value of the PropertySort property. This fix consists of a High Contrast change and a change for non-High Contrast scenarios.
PropertyGrid control ToolBar items which indicates the current value of the PropertySort property support the TogglePattern.
Improved Narrator support for distinguishing the selected alignment in the Alignment Picker.
When an empty PropertyGrid control is displayed on a form, it will now receive focus where previously it would not.
Use of OS-defined colors in High Contrast themes
FlatStyle
property set to a value other than FlatStyle.System. The latter controls are rendered by the OS.<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
Improved keyboard navigation
Improved Narrator support
The MonthCalendar control has added support for assistive technologies to access the control, including the ability for Narrator to read the value of the control when previously it could not.
The CheckedListBox control now notifies Narrator when a CheckBox.CheckState property has been changed. Previously, Narrator did not receive notification and as a result users would not be informed that the CheckState property had been updated.
The LinkLabel control has changed the way it notifies Narrator of the text of in the control. Previously, Narrator announced this text twice and read "&" symbols as real text even though they are not visible to a user. The duplicated text was removed from the Narrator announcements, as well as unnecessary "&" symbols.
The DataGridViewCell control types now correctly report the read-only status to Narrator and other assistive technologies.
Narrator is now able to read the System Menu of child windows in [Multiple-Document Interface]~/docs/framework/winforms/advanced/multiple-document-interface-mdi-applications.md) applications.
Narrator is now able to read ToolStripMenuItem controls with a ToolStripItem.Enabled property set to false. Previously, Narrator was unable to focus on disabled menu items to read the content.
Name | Value |
---|---|
Scope | Major |
Version | 4.8 |
Type | Retargeting |
High Contrast improvements
Screen reader interaction improvements
LiveRegion support
Screen readers, such as Narrator, help people understand the user interface (UI) of an application, usually by describing the UI element that currently has focus. However, if a UI element changes somewhere in the screen and it does not have the focus, the user may not be informed and miss important information. LiveRegions are meant to solve this problem. A developer can use them to inform the screen reader or any other UI Automation client that an important change has been made to a UI element. The screen reader can then decide how and when to inform the user of this change. The LiveSetting property also lets the screen reader know how important it is to inform the user of the change made to the UI.
How to opt in or out of these changes
In order for the application to benefit from these changes, it must run on .NET Framework 4.7.1 or later. The application can benefit from these changes in either of the following ways:
Target .NET Framework 4.7.1. This is the recommended approach. These accessibility changes are enabled by default on WPF applications that target .NET Framework 4.7.1 or later.
It opts out of the legacy accessibility behaviors by adding the following AppContext Switch in the <runtime>
section of the app config file and setting it to false
, as the following example shows.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
</startup>
<runtime>
<!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true/false;key2=true/false' -->
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false" />
</runtime>
</configuration>
Applications that target .NET Framework 4.7.1 or later and want to preserve the legacy accessibility behavior can opt in to the use of legacy accessibility features by explicitly setting this AppContext switch to true
.
For an overview of UI automation, see UI Automation Overview.
Name | Value |
---|---|
Scope | Major |
Version | 4.7.1 |
Type | Retargeting |
Starting with the .NET Framework 4.7.1, a Selector always updates the value of its SelectedValue property before raising the SelectionChanged event, when its selection changes. This makes the SelectedValue property consistent with the other selection properties (SelectedItem and SelectedIndex), which are updated before raising the event.
In the .NET Framework 4.7 and earlier versions, the update to SelectedValue happened before the event in most cases, but it happened after the event if the selection change was caused by changing the SelectedValue property.
Apps that target the .NET Framework 4.7.1 or later can opt out of this change and use legacy behavior by adding the following to the <runtime>
section of the application configuration file:
<runtime>
<AppContextSwitchOverrides
value="Switch.System.Windows.Controls.TabControl.SelectionPropertiesCanLagBehindSelectionChangedEvent=true" />
</runtime>
Apps that target the .NET Framework 4.7 or earlier but are running on the .NET Framework 4.7.1 or later can enable the new behavior by adding the following line to the <runtime>
section of the application .configuration file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Controls.TabControl.SelectionPropertiesCanLagBehindSelectionChangedEvent=false" />
</runtime>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.1 |
Type | Retargeting |
Starting with the .NET Framework 4.7.1, a TabControl updates the value of its SelectedContent property before raising the SelectionChanged event, when its selection changes.In the .NET Framework 4.7 and earlier versions, the update to SelectedContent happened after the event.
Apps that target the .NET Framework 4.7.1 or later can opt out of this change and use legacy behavior by adding the following to the <runtime>
section of the application configuration file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Controls.TabControl.SelectionPropertiesCanLagBehindSelectionChangedEvent=true" />
</runtime>
Apps that target the .NET Framework 4.7 or earlier but are running on the .NET Framework 4.7.1 or later can enable the new behavior by adding the following line to the <runtime>
section of the application .configuration file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Controls.TabControl.SelectionPropertiesCanLagBehindSelectionChangedEvent=false" />
</runtime>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.1 |
Type | Retargeting |
The System.IO.Packaging.PackageDigitalSignatureManager
provides functionality for digital signatures in relation to WPF packages. In the .NET Framework 4.7 and earlier versions, the default algorithm (PackageDigitalSignatureManager.DefaultHashAlgorithm) used for signing parts of a package was SHA1. Due to recent security concerns with SHA1, this default has been changed to SHA256 starting with the .NET Framework 4.7.1. This change affects all package signing, including XPS documents.
A developer who wants to utilize this change while targeting a framework version below .NET Framework 4.7.1 or a developer who requires the previous functionality while targeting .NET Framework 4.7.1 or greater can set the following AppContext flag appropriately. A value of true will result in SHA1 being used as the default algorithm; false results in SHA256.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.MS.Internal.UseSha1AsDefaultHashAlgorithmForDigitalSignatures=true"/>
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.1 |
Type | Retargeting |
The Windows Workflow Foundation (WF) workflow designer is improving how it works with accessibility technologies. These improvements include the following changes:
Microsoft.Activities.AddToDictionary<TKey,TValue>
, Microsoft.Activities.RemoveFromDictionary<TKey,TValue>
, etc.).If you have an application with a re-hosted workflow designer, your application can benefit from these changes by performing either of these actions:
<runtime>
section of the app.config file and set it to false
, as the following example shows.<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
</startup>
<runtime>
<!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true/false;key2=true/false -->
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false" />
</runtime>
</configuration>
Applications that target the .NET Framework 4.7.1 or later and want to preserve the legacy accessibility behavior can opt in to the use of legacy accessibility features by explicitly setting this AppContext switch to true
.
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.1 |
Type | Retargeting |
Unicode specifies several special control characters used to specify the orientation of text. In previous versions of the .NET Framework, these characters were incorrectly stripped from all URIs even if they were present in their percent-encoded form. In order to better follow RFC 3987, we now allow these characters in URIs. When found unencoded in a URI, they are percent-encoded. When found percent-encoded they are left as-is.
For applications that target versions of .NET Framework starting with 4.7.2, support for Unicode bidirectional characters is enabled by default. If this change is undesirable, you can disable it by adding the following AppContextSwitchOverrides switch to the <runtime>
section of the application configuration file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Uri.DontKeepUnicodeBidiFormattingCharacters=true" />
</runtime>
For applications that target earlier versions of the .NET Framework but are running under versions starting with .NET Framework 4.7.2, support for Unicode bidirectional characters is disabled by default. You can enable it by adding the following AppContextSwitchOverrides switch to the <runtime>
section of the application configuration file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Uri.DontKeepUnicodeBidiFormattingCharacters=false" />
</runtime>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.2 |
Type | Retargeting |
Starting with the .NET Framework 4.7.2, the implementation of decompression in the T:System.IO.Compression.DeflateStream
class has changed to use native Windows APIs by default. Typically, this results in a substantial performance improvement. All .NET applications targeting the .NET Framework version 4.7.2 or higher use the native implementation.This change might result in some differences in behavior, which include:
GZipStream
set for decompression is affected):If decompression with native APIs has adversely affected the behavior of your app, you can opt out of this feature by adding the Switch.System.IO.Compression.DoNotUseNativeZipLibraryForDecompression
switch to the runtime
section of your app.config file and setting it to true
:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.Compression.DoNotUseNativeZipLibraryForDecompression=true" />
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.2 |
Type | Retargeting |
In System.Uri, certain percent-encoded characters that were sometimes decoded are now consistently left encoded. This occurs across the properties and methods that access the path, query, fragment, or userinfo components of the URI. The behavior will change only when both of the following are true:
:
, '
, (
, )
, !
or *
.For applications that target versions of .NET Framework starting with 4.7.2, the new decoding behavior is enabled by default. If this change is undesirable, you can disable it by adding the following AppContextSwitchOverrides switch to the <runtime>
section of the application configuration file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Uri.DontEnableStrictRFC3986ReservedCharacterSets=true" />
</runtime>
For applications that target earlier versions of the .NET Framework but are running under versions starting with .NET Framework 4.7.2, the new decoding behavior is disabled by default. You can enable it by adding the following AppContextSwitchOverrides switch to the <runtime>
section of the application configuration file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Uri.DontEnableStrictRFC3986ReservedCharacterSets=false" />
</runtime>
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.2 |
Type | Retargeting |
.resx files may contain binary formatted input. If you attempt to use resgen to load a file that was downloaded from an untrusted location, it will fail to load the input by default.
Resgen users who require loading binary formatted input from untrusted locations can either remove the mark of the web from the input file or apply the opt-out quirk.Add the following registry setting to apply the machine wide opt-out quirk: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\SDK] "AllowProcessOfUntrustedResourceFiles"="true"
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
Starting with .NET Framework 4.7.2, stack traces obtained when using portable PDBs include source file and line information when requested. In versions prior to .NET Framework 4.7.2, source file and line information would be unavailable when using portable PDBs even if explicitly requested.
For applications that target the .NET Framework 4.7.2, you can opt out of the source file and line information when using portable PDBs if it is not desirable by adding the following to the <runtime>
section of your app.config
file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Diagnostics.IgnorePortablePDBsInStackTraces=true" />
</runtime>
For applications that target earlier versions of the .NET Framework but run on the .NET Framework 4.7.2 or later, you can opt in to the source file and line information when using portable PDBs by adding the following to the <runtime>
section of your app.config
file:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Diagnostics.IgnorePortablePDBsInStackTraces=false" />
</runtime>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
Windows Forms Framework is improving how it works with accessibility technologies to better support Windows Forms customers. These include the following changes:
How to opt in or out of these changes In order for the application to benefit from these changes, it must run on the .NET Framework 4.7.2 or later. The application can benefit from these changes in either of the following ways:
<runtime>
section of the app config file and setting it to false
, as the following example shows.<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
</startup>
<runtime>
<!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true/false;key2=true/false -->
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false" />
</runtime>
</configuration>
Note that to opt in to the accessibility features added in .NET Framework 4.7.2, you must also opt in to accessibility features of .NET Framework 4.7.1 as well. Applications that target the .NET Framework 4.7.2 or later and want to preserve the legacy accessibility behavior can opt in to the use of legacy accessibility features by explicitly setting this AppContext switch to true
.
Use of OS-defined colors in High Contrast themes
false
will now use OS-defined colors in High Contrast theme.<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
Improved Narrator support
false
.true
.Improved DataGridView Accessibility support
Improved Visual cues
Improved Property Grid Support
The PropertyGrid control child elements now return a true
for the IsReadOnlyProperty property only when a PropertyGrid element is enabled.
The PropertyGrid control child elements now return a false
for the IsEnabledProperty property only when a PropertyGrid element can be changed by the user.
For an overview of UI automation, see the UI Automation Overview.
ToolStripButton now allows focus when contained within a ToolStripPanel that has the TabStop property set to true
.
Name | Value |
---|---|
Scope | Major |
Version | 4.7.2 |
Type | Retargeting |
In the .NET Framework 4.7.1 and previous versions, the ContextMenuStrip.SourceControl property incorrectly returns null when the user opens the menu from nested ToolStripMenuItem controls. In the .NET Framework 4.7.2 and later, SourceControl property is always set to the actual source control.
How to opt in or out of these changes In order for an application to benefit from these changes, it must run on the .NET Framework 4.7.2 or later. The application can benefit from these changes in either of the following ways:
<runtime>
section of the app.config file and setting it to false
, as the following example shows.<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Forms.UseLegacyContextMenuStripSourceControlValue=false"/>
</runtime>
Applications that target the .NET Framework 4.7.2 or later, and want to preserve the legacy behavior can opt in to the use of the legacy source control value by explicitly setting this AppContext switch to true
.
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
In the .NET Framework 4.7.1 and previous versions, the System.Drawing.Text.PrivateFontCollection class does not release the GDI+ font resources after the PrivateFontCollection is disposed for Font objects that are added to this collection using the AddFontFile(String) method. In the .NET Framework 4.7.2 and later Dispose releases the GDI+ fonts that were added to the collection as files.
How to opt in or out of these changes In order for an application to benefit from these changes, it must run on the .NET Framework 4.7.2 or later. The application can benefit from these changes in either of the following ways:
<runtime>
section of the app.config file and setting it to false
, as the following example shows.<runtime>
<AppContextSwitchOverrides value="Switch.System.Drawing.Text.DoNotRemoveGdiFontsResourcesFromFontCollection=false"/>
</runtime>
Applications that target the .NET Framework 4.7.2 or later, and want to preserve the legacy behavior can opt in to not release font resources by explicitly setting this AppContext switch to true
.
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
In the .NET Framework 4.7.1 and previous versions the DomainUpDown control's DomainUpDown.UpButton() action is ignored when control text is present, and the developer is required to use DomainUpDown.DownButton() action on the control before using DomainUpDown.UpButton() action. Starting with the .NET Framework 4.7.2 both the DomainUpDown.UpButton() and DomainUpDown.DownButton() actions work independently in this scenario and remain in sync.
In order for an application to benefit from these changes, it must run on the .NET Framework 4.7.2 or later. The application can benefit from these changes in either of the following ways:
<runtime>
section of the app config file and setting it to false
, as the following example shows.<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Forms.DomainUpDown.UseLegacyScrolling=false"/>
</runtime>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
Consider a WPF application hosting a WinForms control which in turn hosts WPF controls. Users may not be able to tab out of the WinForms layer if the first or last control in that layer is the WPF System.Windows.Forms.Integration.ElementHost
. This change fixes this issue, and users are now able to tab out of the WinForms layer.Automated applications that rely on focus never escaping the WinForms layer may no longer work as expected.
A developer who wants to utilize this change while targeting a framework version below .NET 4.7.2 can set the following set of AppContext flags to false for the change to be enabled.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false"/>
</runtime>
</configuration>
WPF applications must opt in to all early accessibility improvements to get the later improvements. In other words, both the Switch.UseLegacyAccessibilityFeatures
and the Switch.UseLegacyAccessibilityFeatures.2
switches must be setA developer who requires the previous functionality while targeting .NET 4.7.2 or greater can set the following AppContext flag to true for the change to be disabled.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures.2=true"/>
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
The WPF MarkupCompiler provides compilation services for XAML markup files. In the .NET Framework 4.7.1 and earlier versions, the default hash algorithm used for checksums was SHA1. Due to recent security concerns with SHA1, this default has been changed to SHA256 starting with the .NET Framework 4.7.2. This change affects all checksum generation for markup files during compilation.
A developer who targets .NET Framework 4.7.2 or greater and wants to revert to SHA1 hashing behavior must set the following AppContext flag.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Markup.DoNotUseSha256ForMarkupCompilerChecksumAlgorithm=true"/>
</runtime>
</configuration>
A developer who wants to utilize SHA256 hashing while targeting a framework version below .NET 4.7.2 must set the below AppContext flag. Note that the installed version of the .NET Framework must be 4.7.2 or greater.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Markup.DoNotUseSha256ForMarkupCompilerChecksumAlgorithm=false"/>
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Transparent |
Version | 4.7.2 |
Type | Retargeting |
In .NET Framework 4.7.1 and earlier versions, WPF potentially creates a System.Windows.Threading.Dispatcher on the .NET finalizer thread during AppDomain shutdown. This was fixed in .NET Framework 4.7.2 and later versions by making the cleanup of weak events thread-aware. Due to this, WPF may call Dispatcher.Invoke to complete the cleanup process.In certain applications, this change in finalizer timing can potentially cause exceptions during AppDomain or process shutdown. This is generally seen in applications that do not correctly shut down dispatchers running on worker threads prior to process or AppDomain shutdown. Such applications should take care to properly manage the lifetime of dispatchers.
In .NET Framework 4.7.2 and later versions, developers can disable this fix in order to help alleviate (but not eliminate) timing issues that may occur due to the cleanup change.To disable the change in cleanup, use the following AppContext flag.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.MS.Internal.DoNotInvokeInWeakEventTableShutdownListener=true"/>
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
Suppose you have an ADO collection of items of type Order
, with a relation named "OrderDetails" relating it to a collection of items of type Detail
via the primary key "OrderID". In your WPF app, you can bind a list control to the details for a given order:
<ListBox ItemsSource="{Binding Path=OrderDetails}" >
where the DataContext is an Order
. WPF gets the value of the OrderDetails
property - a collection D of all the Detail
items whose OrderID
matches the OrderID
of the master item. The behavior change arises when you change the primary key OrderID
of the master item. ADO automatically changes the OrderID
of each of the affected records in the Details collection (namely the ones copied into collection D). But what happens to D?
OrderDetails
. The ListBox continues to use collection D, which is now empty.OrderID
property. The ListBox continues to use collection D, and displays the details with the new OrderID
. WPF implements the new behavior by creating collection D in a different way: by calling the ADO method DataRowView.CreateChildView(DataRelation, Boolean) with the followParent
argument set to true
.An app gets the new behavior by using the following AppContext switch.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Data.DoNotUseFollowParentWhenBindingToADODataRelation=false"/>
</runtime>
</configuration>
The switch defaults to true
(old behavior) for apps that target .NET 4.7.1 or below, and to false
(new behavior) for apps that target .NET 4.7.2 or above.
Name | Value |
---|---|
Scope | Minor |
Version | 4.7.2 |
Type | Retargeting |
In the .NET Framework 4.7.1 and earlier versions, WPF System.Windows.Controls.CheckBox and System.Windows.Controls.RadioButton have inconsistent and, in Classic and High Contrast themes, incorrect focus visuals. These issues occur in cases where the controls do not have any content set. This can make the transition between themes confusing and the focus visual hard to see. In the .NET Framework 4.7.2, these visuals are now more consistent across themes and more easily visible in Classic and High Contrast themes.
A developer targeting .NET Framework 4.7.2 that wants to revert to the behavior in .NET 4.7.1 will need to set the following AppContext flag.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures.2=true;"/>
</runtime>
</configuration>
A developer who wants to utilize this change while targeting a framework version below .NET 4.7.2 must set the following AppContext flags.Note that all the flags must be set appropriately and the installed version of the .NET Framework must be 4.7.2 or greater.WPF applications are required to opt in to all earlier accessibility improvements to get the latest improvements. To do this, ensure that both the AppContext switches 'Switch.UseLegacyAccessibilityFeatures' and 'Switch.UseLegacyAccessibilityFeatures.2' are set to false.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false;"/>
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
In .NET Framework 4.7.1 and earlier versions, WPF System.Windows.Controls.TextBox
and System.Windows.Controls.PasswordBox
could only render a text selection in the Adorner layer. In some system themes this would occlude text, making it hard to read. In .NET Framework 4.7.2 and later, developers have an option of enabling a non-Adorner-based selection rendering scheme that alleviates this issue.
A developer who wants to utilize this change must set the following AppContext flag appropriately. To utilize this feature, the installed .NET Framework version must be 4.7.2 or greater.To enabled the non-adorner-based selection, use the following AppContext flag.
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Windows.Controls.Text.UseAdornerForTextboxSelectionRendering=false"/>
</runtime>
</configuration>
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
Under some circumstances when using IWorkflowInstanceManagement.TransactedCancel or IWorkflowInstanceManagement.TransactedTerminate APIs to cancel or terminate a workflow service instance, the workflow instance may encounter a stack overflow due to endless recursion when the Workflow
runtime attempts to persist the service instance as part of processing the request. The problem occurs if the workflow instance is in a state where it is waiting for some other outstanding WCF request to another service to complete. The TransactedCancel
and TransactedTerminate
operations create work items that are queued for the workflow service instance. These work items are not executed as part of the processing of the TransactedCancel/TransactedTerminate
request. Because the workflow service instance is busy waiting for the other outstanding WCF request to complete, the work item created remains queued. The TransactedCancel/TransactedTerminate
operation completes and control is returned back to the client. When the transaction associated with the TransactedCancel/TransactedTerminate
operation attempts to commit, it needs to persist the workflow service instance state. But because there is an outstanding WCF
request for the instance, the Workflow runtime cannot persist the workflow service instance, and an endless recursion loop leads to the stack overflow.Because TransactedCancel
and TransactedTerminate
only create a work item in memory, the fact that a transaction exists doesn't have any effect. A rollback of the transaction does not discard the work item.To address this issue, starting in .NET Framework 4.7.2, we have introduced an AppSetting
that can be added to the web.config/app.config
of the workflow service that tells it to ignore transactions for TransactedCancel
and TransactedTerminate
. This allows the transaction to commit without waiting for the workflow instance to persist. The AppSetting for this feature is named microsoft:WorkflowServices:IgnoreTransactionsForTransactedCancelAndTransactedTerminate
. A value of true
indicates that the transaction should be ignored, thus avoiding the stack overflow. The default value of this AppSetting is false
, so existing workflow service instances are not affected.
If you are using AppFabric or another IWorkflowInstanceManagement client and are encountering a stack overflow in the workflow service instance when trying to cancel or terminate a workflow instance, you can add the following to the <appSettings>
section of the web.config/app.config file for the workflow service:
<add key="microsoft:WorkflowServices:IgnoreTransactionsForTransactedCancelAndTransactedTerminate" value="true"/>
If you are not encountering the problem, you do not need to do this.
Name | Value |
---|---|
Scope | Edge |
Version | 4.7.2 |
Type | Retargeting |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Implement exception handling in C# console applications - Training
This module explores the use of exceptions and the exception handling process in C# console applications. Hands-on activities provide experience implementing exception handling patterns for various coding scenarios.