-
Notifications
You must be signed in to change notification settings - Fork 986
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
Creating/Saving a Settings file throws error #3346
Comments
@docfresh I appreciate you have spent the time to raise the issue, but issues with VS and VS Designer should be sent via VS Feedback channel (the icon in the top right hand side corner). The reason for this - the VS Feedback tool captures a lot of additional information (such as screenshots, memory dumps, stack traces, assembly versions, etc.) that can help us to investigate your issue and identify the cause. |
Just to let you know, this issue has not yet been implemented by the team. We have it high on our backlog and look forward to having it available in an upcoming VS preview. I'll circle back and let you know when we've gotten the work done. Designer issue (sorry this isn't public at this point, just linking for internal reference) |
@merriemcgaw could we create a single list (issue) for all the things that are know to be broken with VB and Designer. It would save a lot of reporting and then we would know what issue we find that should be added. This was done initially for VB Core and in that case others could contribute. For example I don't see that the designer corrupts VB Project files that have local Custom Control or that it adds a namespace to designer.vb file for each local User Control reference. I believe both of these things are not supported by observation but you don't get that from the blog of what IS supported. |
Providing you with a list would not be productive - the list is constantly changing. But the team looks at all issues that are raised via the VS Feedback (the icon in the top right hand side corner). And this is one of the reasons why issues with VS and VS Designer should be sent via the VS Feedback. |
@RussKie my apologies, I will use VS Feedback in the future. FYI I made a linked issue on the try-convert project here; they are adding a warning about app.config |
@RussKie stock answer from Feedback is VB is not supported by Designer even though it has been, to some extent, since VSIX preview and they close the issue but I will continue to use that method. I didn't want to bother on issues that are known to not work. |
I would like to add additional information, there are two related issues. If a valid settings.Designer.VB files exists you get the error above. If there is no settings.Designer.VB File there is message/link on the Settings screen "The project does not contain a default settings file. Click here to create one". Followed by the error message shown when you click. https://files.gitter.im/59b31bd6d73408ce4f74f5b4/wuqh/image.png |
@KlausLoeffelmann should be able to update us on the current state of VB support in .NET 5/Visual Studio. We're making a lot of progress there. |
For C#: Settings work just fine for me in WinForms. I can add Settings, if they don't exist, and I can edit Settings. Also the Code Generator producing the Setting.Designer.cs is working just fine. |
Not sure I followed directions correctly, but I creates Settings.settings, filled it out using VS UI, saved and built, I now get
|
3.1 or 5? C# or VB? |
App.Config file that gets created <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
<section name="FindWordApp.MySettings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<userSettings>
<FindWordApp.MySettings>
<setting name="TextBox1" serializeAs="String">
<value />
</setting>
<setting name="TextBox2" serializeAs="String">
<value />
</setting>
<setting name="TextBox3" serializeAs="String">
<value />
</setting>
<setting name="TextBox4" serializeAs="String">
<value />
</setting>
<setting name="TextBox5" serializeAs="String">
<value />
</setting>
<setting name="TextBox6" serializeAs="String">
<value />
</setting>
<setting name="TextBox7" serializeAs="String">
<value>A</value>
</setting>
<setting name="UpgradeRequired" serializeAs="String">
<value>True</value>
</setting>
<setting name="LettersInPlay" serializeAs="String">
<value>5</value>
</setting>
<setting name="WordLength" serializeAs="String">
<value>5</value>
</setting>
<setting name="PrimingWord" serializeAs="String">
<value>Hello</value>
</setting>
</FindWordApp.MySettings>
</userSettings>
</configuration> If this file exists you get a runtime exception trying to access UpgradeRequired |
@KlausLoeffelmann if settings are not going to be fixed for release (since its priority 2), can someone provide documentation on what is expected in empty App.Config so designer works and what workaround is needed to expose Settings to application. Will #3346 (comment) still work and if not what is needed? There are 2 different scenarios that both have issues;
|
@RussKie @KlausLoeffelmann @Zheng-Li01 @merriemcgaw Update with Preview 2, Core 5, you still can't create new setting file, if one exists from Framework you get same error while trying to open but it does open. |
We're still working on the Settings files and what should happen with app.config files. We will keep you posted. |
Hi, I just download VS2019 latest version, and when I create new project both .Net5 and .Net Core 3.1 still found the same issue... |
This is on our backlog of features we want to get into the next release, but we've got a lot of competing priorities so I'm not quite able to commit to a particular release at this time. |
Is there any workaround? Is App.Config still used? updating Settings does not update it but the changed settings seem to work in the application. |
Adding @JeremyKuhne to see what his thoughts are for an alternative approach, |
Yes, for the time being, we will keep app.config. As a workaround: That should solve the problems for runtime and designer. |
@KlausLoeffelmann could we have a specific example the first doesn't help and the second is an error
|
@KlausLoeffelmann If I look at App.config, after I change a setting it does not reflect the changes. After I delete the logging section from App.Config it is never put back. In both cases the changes I make to setting (values or additional setting) do from through to the application. I don't see any way to add/change the log settings in Visual Studio other then creating a new project. |
Well, basically what's happening is that when the App.Config gets written, the .NET (not the .NET Framework) types get written out. Which is principally OK, but: At runtime, the Framework process tries to resolve those types being stated in the app config, and of course it can't. And that's why we're seeing the errors: VS running in the Framework process can simply not deal with the types. Now, what should happen is: Deserializing the types in App.Config should be happening in the Core process (the App.Config should be send over, then be deserialized, and then proxies of the types should be being processed from that point on in the Framework (VS) process.) The question is: Do we want to continue using App.Config at all for this purpose, and how are we dealing with the backwards compatibility of types here (you updated let's say your machine to .NET 5.0.4, but your team members are not yet running that update - what version should be serialized then? 5.0? 5.0.4? And what about 6.0? Should you be able to open a 6.0 config file in a 5.0 app? Those discussions we're leading currently. Since Framework types will be forwarded to Core in general, the workaround of putting the Framework types there is definitely working - I just tested that. I probably forgot to mention, that the
Can you test that if that is working for you? (We're also need to figure out, how the settings feature will be featured in the new Project Properties UI. Currently, in the new UI, we can't create or edit settings at all, and here is an item for that in PS: |
@KlausLoeffelmann making that change causes 2 errors in designer with very clean messages about settings and App.Config differing. Accepting both seems to do everything correctly and they don't happen again. I still need to delete logging section or I get a runtime error. Should the default App.Config on new applications be upgraded to above?
|
That is a question @merriemcgaw and @KathleenDollard are discussing, currently. |
In the interest of transparency, we do obviously have a number of gaps and regressions in Settings and Resource handling, but most of those lie outside the realm of our team. We are working with sister teams to identify correct owners and facilitate fixes. Unfortunately there are no ETAs of any kind at the moment. |
This comment has been minimized.
This comment has been minimized.
I don't want/use logging it is just what comes over from framework. |
@paul1956 I had a debugging session today, and discovered that the diagnostics section you mentioned in #3346 (comment) comes from a app.config template owned by Project System team. Please raise a VS Feedback issue for it. If you post the link here I can make sure it gets assigned to the area owner team. /cc: @jjmew @drewnoakes |
The Project System does not own any templates. Are you referring to https://github.com/dotnet/templates or https://github.com/dotnet/templating? |
@drewnoakes please refer to AB#1386445 which has some relevant details. |
@paul1956 please see dotnet/project-system#6784 |
I am currently on a ship bound for Alaska and will lose internet shortly. I will do this next Wednesday when I return. Thanks. |
Enjoy your trip! 🍸 |
Is this fixed yet? I just upgraded my VS 2019 for latest release 16.11.3. I am creating a new VB.NET project in VS 2019, with .NET 5.0. And it complains to even open the Project Settings panel. Whether I add new string params, they wont work. Any workaround is appreciated |
@VitalLogic please see dotnet/project-system#6784 |
.NET Core Version:
3.1
Have you experienced this same bug with .NET Framework?:
No
Problem description:
I used try-convert to convert a near-empty .NET 4.72 Framework project to .NET Core.
When trying to add a settings file, I get the error "An error occurred while reading the app. config file. The file might be corrupted or contain invalid XML" when creating a new Settings file and saving it. I also get the error "The Method or operation is not implemented" when clicking the "View Code" button. The settings do seem to work though.
Even if I delete and recreate the settings file, I still get the error.
Expected behavior:
Don't get an error.
Minimal repro:
The text was updated successfully, but these errors were encountered: