Skip to content
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

Can't locate embedded satellite assembly #912

Open
1 of 6 tasks
MikiraSora opened this issue Sep 23, 2023 · 5 comments
Open
1 of 6 tasks

Can't locate embedded satellite assembly #912

MikiraSora opened this issue Sep 23, 2023 · 5 comments

Comments

@MikiraSora
Copy link

MikiraSora commented Sep 23, 2023

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

  1. get Costura.Fody 5.7.0 from nuget
  2. run

Expected Behavior

locate embedded satellite assembly successfully

Actual Behavior

LLI6 H1F5WKT~2T1E@%37SJ

@GeertvanHorrik
Copy link
Member

Excellent find. Are you interested in providing a fix? A few ways to help out could be:

  1. Write a failing unit test
  2. Include the actual fix

Thank you!

@MikiraSora
Copy link
Author

I will try write a fix but I have to read and learn repo fully

@MikiraSora
Copy link
Author

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.

@JerryJian
Copy link

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]);
                    }
                }
            }
        }
    }
    ...
}

@MikiraSora
Copy link
Author

here is my method to solve : link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants