.NET Core Version:
.NET 5.0-rc1 using Visual Studio 16.8.0 Preview 3.0.
Have you experienced this same bug with .NET Framework?:
No.
Problem description:
Assigning a project image resource e. g. to the Image property of a button using the Windows Forms Designer results in copying the corresponding resource file from the global project resources to the local form resource and adding following line in the designer code file:
this.InOK.Image = ((System.Drawing.Image)(resources.GetObject("InOK.Image")));
Expected behavior:
The global resource should be used directly as it was the case previously in the .NET Framework. The expected line in the designer code should be similar to this:
this.InOK.Image = global::QuickArchive.Properties.Resources.ok_16;
We faced this behavior too, but not 100% of the time and we could not understand the conditions under which this occurs.
First thanks a lot for the quick feedback on this @kirsan31!
Is there anything I can do or test to help you to pin-point this issue?
I just tried that again with a completely new .NET 5.0 project - here a minimal example project:
ProjectResourceTest.zip
But you say that you don't see this behavior all the time, @kirsan31?
I tried it a few times with new projects now and I get the same behavior all the time.
Perhaps you could try with the example project above and if you still can't reproduce the issue please let me know how I can help to further investigate this. Thanks!
This is a pretty annoying issue for me to be honest as I have a project were a lot global project image resources are used and now everything is copied kind of 100 times all across the forms. ;-)
@KlausLoeffelmann , @dreddy-work - what are your thoughts?
@ab-tools sorry, I didn't put it exactly. We not use new core designer, we use old .net designer for core project: <TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>. And in such a configuration some times we see behavior like you described.
But I tested new core designer and pure netcoreapp3.1/net5 project and can confirm this bug with 100% reproducibility. Moreover, the new designer does not understand global resources at all:

Must be (.net designer):

Thanks, @kirsan31, yes, I also noticed that in the meantime: The new designer simply deletes all global image resources from the designer file.
@KlausLoeffelmann , @dreddy-work - what are your thoughts?
Seems something regressed. Need to check the serialization.
Should this be tracked on the designer side @dreddy-work ?
Just checked on 16.8.0 P5 - same behavior (not working).
I am looking into it currently. Will update this thread soon.
This is still happening on 16.8.0.
Also, the net5 designer does not show images for buttons created in netfx, however when running the program the images show as expected
May I ask if there any progress with this issue? It's the showstopper in our migration.
This is a design time issue and work is currently in progress. Basic scenarios implemented and work in progress for some build/rebuild scenarios. Expect it to be available in VS 16.9 preview 3.
Good to hear that this is currently in progress - thanks for the update on this @dreddy-work!
Most helpful comment
I am looking into it currently. Will update this thread soon.