-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating the Default Settings file in a WinForms .NET 5 Visual Basic app fails. #6784
Comments
The issue here is that we've serialized a The problem is when we want to read that data later. The .NET Framework 4.8 (running in VS) doesn't know anything about that the .NET 5 assembly, and so it can't deserialize it for us. The The only solution I can think of is to have a variant of the |
My proposed solution will not work here. The System.Configuration shim assembly in .NET 5 does not have a type forwarder for |
Hello, When we add or modify parameters or values of these parameters and save the new information, we get the display of an error message. Message : When using a parameter reading using one of the following instructions Here are the details of the error. Here is just my test program. `Class MainWindow
End Class` The same program in C # works fine. What is the solution in VB? |
Hello, On the other hand, from the parameter data grid, there is always the display of the error message when adding or modifying the parameters or the values of these parameters when saving the new information. |
@melytc @KlausLoeffelmann @KathleenDollard the diagnostics section is defined in a template under |
Copying from AB#1388851 Different scenarios with associated steps to reproduce can be found at https://gist.github.com/RussKie/e33dd2ee4dc18a04f9237b6b42db9596 This is a functionality gap that impacts migration scenarios. In essence, whenever Settings.settings are written into an app.config versions must be locked at 4.0.0.0 and not at the current app's TFM: <configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="settings_issue.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="settings_issue.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections> |
.NET FrameworkA brand new VB Windows Forms .NET Framework (4.7.2) app contains the following app.config Adding/modifying settings makes the following changes to the app.config: .NETA brand new VB Windows Forms .NET (6.0) app does not contain an app.config. |
The second key problem is that the types are written against the app's TFM (e.g. net5.0), which is different from the VS TFM (net472), and this makes VS unable to parse the app.config. And it fails here: project-system/src/Microsoft.VisualStudio.Editors/SettingsDesigner/SettingsDesignerLoader.vb Lines 476 to 496 in 648af14
Here's what's is being currently serialised (-) instead of what must be serialised (+): <configSections>
- <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
+ <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
- <section name="WinFormsApp1.My.MySettings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+ <section name="WinFormsApp1.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
- <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
+ <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
- <section name="WinFormsApp1.My.MySettings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" requirePermission="false" />
+ <section name="WinFormsApp1.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
|
* Pin configuration type names to the desktop identities so not only we can create necessary configuration sections and serialize data, but also that we can deserialize those as well. Affected types: - System.Configuration.ApplicationSettingsGroup - System.Configuration.ClientSettingsSection - System.Configuration.UserSettingsGroup Fixes #6784 Resolves dotnet/winforms#4308 * Remove ability to browse and serialize arbitrary types, and restrict the set of type to the the known list Resolves https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1388857/
Reopening as the rogue system.diagnostics section is still unaddressed. @KathleenDollard and @KlausLoeffelmann need to make a call. |
@KlausLoeffelmann / @KathleenDollard a quick ping here to see how we want to proceed (most importantly for .NET 6 apps) |
We need to discuss this with @melytc in the upcoming project system/vb sync. |
Change missing here is removing the |
The PR https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/403807 should handle the issue in |
Visual Studio Version:
>=16.8
Summary:
Attempting to save after changing a value in the Default Settings file of a WinForms .NET 5 Visual Basic app fails.
Steps to Reproduce:
Expected Behavior:
Settings file should be written, settings designer code be generated.
Actual Behavior:
Exception:
'An error occurred creating the configuration section handler for userSettings/VbWinForms5EventTest.Settings: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'
User Impact:
Interactively using the settings designer in a .NET 5 VB WinForms App is not possible.
Stack Trace:
The text was updated successfully, but these errors were encountered: