Symptoms

Assume that you have Microsoft .NET Framework 4.7 installed on a computer. You may notice that the applications that run on the .NET Framework don't respect the compatibility settings that are specified in the registry for AppContext switches. In this scenario, when you try to set a registry option for an AppContext flag, it behaves as if the value that's specified in the registry option is set to False.

Cause

When the program reads the value of an AppContext switch in the registry, the data cannot be retrieved. In this case, it is assumed that something is wrong with the way the setting is specified in the registry, and a value of False is returned to the application.

Resolution

To fix this issue, use the application configuration (app.config) file to set the flag to the desired value.

Add an <AppContextSwitchOverrides> element to the <runtime> section of the app.config file. The switch has a single attribute, that is, value, whose value is a string that represents a key or value pair that contains both the switch name and the value.

To define multiple switches, separate each switch's key or value pair in the <AppContextSwitchOverrides> element's value attribute with a semicolon. In that case, the <AppContextSwitchOverrides> element has the following format:

XML

<AppContextSwitchOverrides value=”switchName1=value1;switchName2=value2” />

Using the <AppContextSwitchOverrides> element to define a configuration setting has the application scope. That is, it affects only the application.

Because app.config files are application specific, you must do this for all affected applications.

For more information about AppContext, go to the following topic on the Microsoft Developer Network (MSDN) website:

AppContext Class

More Information

This issue was introduced as part of the work to enable AppContext switches to be used very early in the AppDomain life cycle. This allowed changes that would otherwise be breaking to be done safely, even if the code that needed to use an AppContext switch ran very early in the AppDomain bring-up.

The issue is about how much memory is allocated to store the value that's read from the registry. If the allocated space to store the value that's read from the registry is insufficient, it will fall back to the default value of False

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section and Microsoft is working on a solution in the upcoming versions of the product.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.