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

ResourceLoader consistenly throws an exception of type 'System.TypeInitializationException' #16688

Open
MartinZikmund opened this issue May 11, 2024 Discussed in #16328 · 0 comments
Assignees
Labels
kind/enhancement New feature or request project/resources 🈷️ Categorizes an issue or PR as relevant to resources and localization (Resources, Assets,...)

Comments

@MartinZikmund
Copy link
Member

Discussed in #16328

Originally posted by axtens April 17, 2024
Context: Uno4; VS2o22Community; Windows11

I had adapted code in the Switching to string resources (specifically, in the Reading string resources in code section) to store some JavaScript locally rather than depend on the internet to be always present.

The code I came up with for reading the custom RESX resource in String\en\JavaScriptLibraries.resx

using Windows.ApplicationModel.Resources;

namespace PelotonIDE.Presentation
{
    public static class JavaScriptLibrariesHelper
    {
        static ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView("JavaScriptLibraries");
        public static string GetJavaScriptLibrariesResource(string name)
        {
            return _resourceLoader.GetString(name);
        }
    }
}

In discord earlier problems with this were said to be able to be worked around using #11899, however I didn't find it particularly helpful.

Using the above code consistently fails with a COM error of some sort, namely
image

@MartinZikmund MartinZikmund self-assigned this May 13, 2024
@jeromelaban jeromelaban added project/resources 🈷️ Categorizes an issue or PR as relevant to resources and localization (Resources, Assets,...) kind/enhancement New feature or request labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request project/resources 🈷️ Categorizes an issue or PR as relevant to resources and localization (Resources, Assets,...)
Projects
None yet
Development

No branches or pull requests

2 participants