Can't locate embedded satellite assembly
MikiraSora opened this issue · comments
Please check all of the platforms you are having the issue on (if platform is not listed, it is not supported)
- WPF
- UWP
- iOS
- Android
- .NET Standard
- .NET Core
Component
AssemblyLoader.ReadFromEmbeddedResources() can't locate embedded satellite assembly because name contain uppercase letter
https://github.com/Fody/Costura/blob/develop/src/Costura.Template/Common.cs#L134C7-L134C7
requestedAssemblyName.CultureInfo.Name
may contain uppercase letters
Version of Library
5.7.0
Version of OS(s) listed above with issue
Win
Steps to Reproduce
- get Costura.Fody 5.7.0 from nuget
- run
Expected Behavior
locate embedded satellite assembly successfully
Actual Behavior
Excellent find. Are you interested in providing a fix? A few ways to help out could be:
- Write a failing unit test
- Include the actual fix
Thank you!
I will try write a fix but I have to read and learn repo fully
It's hard to compile source and take unit test.
I don't think I have the ability to fix these codes. So I hope you can personally repair it, after all, the reason has already been found.
A workaround, at the entry point of the program, modify the assemblyNames
cache:
static int Main(string[] args)
{
var loader = typeof(Program).Assembly.GetType("Costura.AssemblyLoader");
if (loader != null)
{
var field = loader.GetField("assemblyNames", BindingFlags.Static | BindingFlags.NonPublic);
if (field != null && field.GetValue(null) is Dictionary<string, string> dict)
{
foreach (var item in dict.Keys.ToList())
{
if (item.Contains("zh-hans"))
{
var upperName = item.Replace("zh-hans", "zh-Hans");
if (!dict.ContainsKey(upperName))
{
dict.Add(upperName, dict[item]);
}
}
}
}
}
...
}
here is my method to solve : link