Skip to content

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

Open
@tarilabs

Description

@tarilabs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions