s k
s k

Reputation: 5212

VS2022 updates broke resource file?

Try to add new resource file, get this error immediately after adding

Error with new resource file

Try to add a new item into existing file, no error, but it doesn't run the custom tool

Add entry to existing resource file

The properties of the resource file, which had been working all the while until yesterday's update

Resource file properties

When I try to use the entry in my page, the newly added entry doesn't exist.

Error while trying to add the resource entry in code

Microsoft Visual Studio Community 2022 Version 17.11.0 VisualStudio.17.Release/17.11.0+35208.52 Microsoft .NET Framework Version 4.8.09032

Installed Version: Community

ASP.NET and Web Tools 17.11.230.51983 ASP.NET and Web Tools

C# Tools 4.11.0-3.24374.1+f99bb16a395e48a05520ba7af1549b20bfdeee36 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Razor (ASP.NET Core) 17.11.3.2436904+f07c7bb8e623ebcc1e1028cf11d101f866c77a79 Provides languages services for ASP.NET Core Razor.

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.


Answering my own question.

Temporary work around.

  1. Create another entry in the resource file
  2. Save the file
  3. Reopen the file
  4. Select the temporary entry (make sure you select the entire row using the far left column). And delete it.

Some how it works for me.

Don't ask me way.

Upvotes: 3

Views: 3780

Answers (3)

John Van der Aa
John Van der Aa

Reputation: 71

The new resource editor is indeed a proverbial pain in the backside. Even after a few more updates (currently on 7.11.5) its still buggy as f***.

Currently for me its even causing my entire Visual Studio to crash, loosing code in the proces.

For now my workaround is to open them trough right click -> open with and select Managed Resource Editor (Legacy). Just select this option and press the Default button to revert back to the classic editor as a default till Microsoft can wrap its head around and fix it.

Perhaps Microsoft can also learn to release features like this after a more extensive testing phase as should be done with all software development?

Upvotes: 7

Melissa Treviño
Melissa Treviño

Reputation: 61

I am developing the Resource Explorer there. Stumbled upon this question from here: https://developercommunity.visualstudio.com/t/Resource-file-cant-access-byte/10727183

I suspect the issue was that the Resource Explorer was adding your file as a System.String instead of a System.Byte[]. We have changed that, differentiating between a text file (System.String) and a file (System.Byte[]).

If you want to give it a try, the fix should be soon in the VS preview version (https://visualstudio.microsoft.com/vs/preview/#download-preview).

As for the old experience, it is still available through: Solution Explorer > right click the resource file > Open With... > Managed Resource Editor (Legacy). Hope this unblocks you!

If you have any other feedback on that experience, please consider opening feedback tickets at https://developercommunity.visualstudio.com/VisualStudio, mentioning "Resource Explorer" should come my way :) thanks!

Upvotes: 5

SiRaDuDe
SiRaDuDe

Reputation: 41

I also had problems with the resource file after updating to VS2022 ver 7.11.0

In my case, WPF desktop App, .Net 6.

I have a file Byte[] previously imported to the resource, that I later write out to disk using "WriteAllBytes()". If I use the original Byte[] file previously imported before update, all works fine. But if I replace the file using the new resource interface, the WriteAllBytes() function fails with the following:

System.MissingMethodException: 'Constructor on type 'System.Byte[]' not found.'

Similar problem occurs if I use WriteAllText() on a newly imported string file, (but works on previously imported strings file)

My solution was to rollback the update until a workaround or help on solving this can be found. RollBack can be done via the VS Installer.

Upvotes: 1

Related Questions