Skip to content

IronPython.Hosting.Python.CreateEngine in Blazor 5 - WebAssembly .Net5.  #769

@JimmyHeartbreaker

Description

@JimmyHeartbreaker

Description

I am using a 3rd party library targeting .netstandard2.0 in Blazor which is built on web assembly which uses mono.
This library uses IronPython.
In Blazor version 3.2.1 IronPython works but in 5.0.2 it does not.

Steps to Reproduce

Create a Blazor .net 5 app.
Run IronPython.Hosting.Python.CreateEngine(IDictionary`2 options)

See error below - is it possible to disable console input?

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: failed to evaluate assumptions. CorrelationId=="5f178588-9796-4c4f-968a-4cdd8079e303",
System.Reflection.TargetInvocationException: Failed to load language 'IronPython 2.7.11': The type initializer for 'Microsoft.Scripting.Utils.ConsoleInputStream' threw an exception.
---> System.TypeInitializationException: The type initializer for 'Microsoft.Scripting.Utils.ConsoleInputStream' threw an exception.
---> System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.ConsolePal.OpenStandardInput()
at System.Console.OpenStandardInput()
at Microsoft.Scripting.Utils.ConsoleInputStream..ctor()
at Microsoft.Scripting.Utils.ConsoleInputStream..cctor()
--- End of inner exception stack trace ---
at Microsoft.Scripting.Runtime.SharedIO.InitializeInput()
at Microsoft.Scripting.Runtime.SharedIO.get_InputReader()
at Microsoft.Scripting.Runtime.SharedIO.GetReader(Encoding& encoding)
at IronPython.Runtime.PythonFile.CreateConsoleReader()
at IronPython.Runtime.PythonFile.InitializeConsole(SharedIO io, ConsoleStreamType type, String name)
at IronPython.Runtime.PythonFile.CreateConsole(PythonContext context, SharedIO io, ConsoleStreamType type, String name)
at IronPython.Runtime.PythonContext.SetStandardIO()
at IronPython.Runtime.PythonContext.InitializeSystemState()
at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager, IDictionary2 options) at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, Object[] parameters, Boolean wrapExceptions) --- End of inner exception stack trace --- at Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager domainManager, Boolean& alreadyLoaded) at Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager manager, LanguageConfiguration config) at Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager manager, AssemblyQualifiedTypeName& providerName, LanguageContext& language) at Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String providerAssemblyQualifiedTypeName) at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String assemblyQualifiedTypeName) at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) at IronPython.Hosting.Python.CreateEngine(IDictionary2 options)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions