dotnet / dotnet/msbuild

EmbeddedResource is non-deterministic based on culture

Open
#9,152 4 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Describe the bug
The behavior of `` will change based on the culture settings of the current environment. By default it attempts to do culture specific resource handling. This is accomplished by taking the last portion of the file name, checking if it's a valid culture, if so then treat it like a culture specific resource. There is no way to override this behavior.

That means though if the final portion of your file name is a culture name on the current environment then it will be treated differently than other resources. Different OS / runtimes can have different cultures which altogether makes for non-deterministic behavior.

### To Reproduce

1. Create a simple console app
2. Create a file called _bin\System.Reflection.Metadata.dll_.
3. Include the following in your build file:

```xml

net.Metadata

```

4. Build

On Windows using `dotnet build` or `msbuild` this will produce a binary that has an embedded resource named `net.Metadata`. On Linux it will not because `"metadata"` is a valid culture name.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.