-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Non-Resx Embedded Resources get mangled names, possible name collisions #4740
Comments
@Anipik can you zip up the project and add it to the issue? Does setting |
yes setting |
Looks like this was regressed with #4597. @benvillalobos @rainersigwald I wonder if the DependentUpon heuristic should be scoped a little? |
We probably should have only applied the convention to .resx resources. |
If we want to change this, we should do it ideally quickly as it would be breaking to change the resource names again. I think we're too late for 3.0 which makes this difficult. :( |
Restricting to resx makes sense because that is the case that would have been persisted with DependentUpon in a classic project. I'm not aware of anything that would have put DependentUpon for non-resx in your project unless you did it manually so I don't think it should have been part of the convention to do so. |
A very similar repro could be constructed for a resx though, in some cases the convention will pick a different name than earlier previews (that's the point of the change after all) so it is to be expected that some projects will be broken by the convention, this is why I insisted on scoping the default to TFM so that it would only break 3.0 preview projects. But it is unfortunate that non-resx is affected at all. |
It turns out that this changes the extension from .bmp or .jpg or whatever else non-resx to blank. So even if the source file found by convention has first class RootNamespace.Folder.Filename, the manifest resource will not match what you would get without the inferred DependentUpon |
I imagine there will also be build errors if you have say Foo.txt and Foo.bmp as embedded resources next to Foo.cs. Without preserving the extension, this will cause duplicate resource names. |
Looks like there's another related failure mode here:
From https://dev.azure.com/dnceng/public/_build/results?buildId=361408&view=results (thanks, @ViktorHofer). We'll have to dig in, but I suspect this is the thing Nick predicted
|
That CSC failure is because these source files have a class named C in them: And they have DLLs embedded with the same name as the source file: |
Alright, I think we need to remove the convention from affecting non-resx resources. It's becoming pretty clear to me that the odds of wanting the convention to apply (even if it preserved extension) are close to zero. I suspect eveyone in this case is going to disable the convention. This is strictly a breaking change from 3.0 /16.3 GA (assuming we cannot get this fix into that, and I don't think we can), but I will bet that most of the people who hit this will disable the convention entirely and therefore not get re-broken when it gets less aggressive. I would consider taking this in 16.0.x/3.0.1xx servicing as quickly as feasible so that the window of time to take a dependency on this odd, non-deliberate fallout from the change is as short as possible. @livarcocc @ericstj @rainersigwald Do you agree? |
restrict convention to service for it: probably |
Maybe 16.4/3.1 being not too far out is good enough. If we think most people with this code pattern will have to disable the convention, then it's not really breaking, and will help others who only move to 3.x when it goes LTS. |
Just a note that there is another hit count on this from a customer in a mail thread. |
HitCount++ https://twitter.com/simoncropp/status/1175385910919090176?s=21 This one is the other duplicate name case I predicted. |
Got hit by this in all my projects, after upgrading to VS 16.3 Thankfully the EmbeddedResourceUseDependentUponConvention=false workaround works, but it took me 3 missing hours to figure what happen. |
@panost i feel your pain. i burnt 2 hours :) |
Sorry for the troubles, folks. This issue is now listed as a .NET Core 3.0 known issue to hopefully improve visibility. |
Fixed for 16.3 servicing (and 16.4) by #4764. |
For folks who stumble onto this closed issue, refer to this dotnet docs issue for a detailed explanation on how manifest resource naming works now. |
Underlying issue is fixed: dotnet/msbuild#4740
Underlying issue is fixed: dotnet/msbuild#4740
I was able to create a small repro
the csproj looks like this
Program.cs
MyResource.cs
Running this code under preview 7 gives output as
where as running this code under preview 9 gives output as
I checked dlls
the resource name include in .dll in previe9 is resourceName.MyResource where as under preview 7 is resourceName.MyResource.bmp
I hit this error while building corefx with preview9 for testData.resources file.
This works fine with 5.0 as well.
cc @ericstj @danmosemsft @livarcocc
The text was updated successfully, but these errors were encountered: