Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Mac OS: The type initializer for 'Microsoft.PowerFx.Core.Texl.BuiltinFunctionsCore' threw an exception #10

Open
tarilabs opened this issue Dec 29, 2021 · 0 comments

Comments

@tarilabs
Copy link

I've been trying these samples on macOS 11.6.1
I am using .Net: 6.0.101

but I get the following error trying the WebDemo and ConsoleREPL:

The type initializer for 'Microsoft.PowerFx.Core.Texl.BuiltinFunctionsCore' threw an exception

To fix the issue, I've locally modified the samples taking inspiration from microsoft/Power-Fx#71 (comment)

ConsoleREPL

To fix the issue I've added:

CultureInfo.CurrentCulture = new CultureInfo("en-US");

before this ResetEngine(); line:

public static void Main()
{
ResetEngine();

Before:

image

After:

image

Web

Since I could not find ASP.Net redistributable for .Net Core 3.1 for Mac OS X,
I've replaced this line:

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

to read

    <TargetFramework>netcoreapp6.0</TargetFramework>

instead.

Then, I've changed this line:

public RecalcEngine GetEngine()
{
// If the engine requires additional symbols to load, server
// should find a way to safely cache it.
var engine = new RecalcEngine();

to read:

        public RecalcEngine GetEngine()
        {
            // If the engine requires additional symbols to load, server
            // should find a way to safely cache it.
            CultureInfo.CurrentCulture = new CultureInfo("en-US");
            var engine = new RecalcEngine();

instead.

Please notice I've tried to just pass new CultureInfo("en-US") as an argument to the RecalcEngine constructor, but that didn't solve 🤷

Pardon me if there is a simpler solution but I'm very new to .Net! 😆

The above solves for me on Mac OS.
Before:
Screenshot 2021-12-29 at 11 11 02

After:
Screenshot 2021-12-29 at 14 24 44

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

No branches or pull requests

1 participant