IronLanguages / IronLanguages/ironpython3

Error with running IronPython 3.4.1 on existing Windows .NET4.7.2 project

Open
#1,802 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

Prerequisites

I'm working to add the latest stable version of IronPython to a large existing project. This project runs .NET 4.7.2, built for Windows x64 and built on Windows 10 with Visual Studio 2022. IronPython was added via NuGet.

I've had this issue for quite a while and have done a significant amount of research, but there is not much information on this topic.

Description

When running IronPython the initialization of an engine with Python.CreateEngine(); functions properly, but when I attempt to execute engine.Execute(code, scope); with the correct relevant code string and scope object I get a PlatformNotSupportedException. I have had a great deal of trouble trying to find the cause of this issue. This is the specific error:

PlatformNotSupportedException: Operation is not supported on this platform.
  at Microsoft.Scripting.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) [0x001f4] in <9784853821ea47dbb6bb1f3e03091049>:0 
  at Microsoft.Scripting.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) [0x00023] in <9784853821ea47dbb6bb1f3e03091049>:0 
  at Microsoft.Scripting.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) [0x00000] in <9784853821ea47dbb6bb1f3e03091049>:0 
  at Microsoft.Scripting.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.StrongBox`1[System.Object][] closure) [0x00047] in <9784853821ea47dbb6bb1f3e03091049>:0 
  at Microsoft.Scripting.Interpreter.LightDelegateCreator.CreateDelegate () [0x00000] in <9784853821ea47dbb6bb1f3e03091049>:0 
  at Microsoft.Scripting.Ast.LightExpression`1[T].Compile (System.Int32 compilationThreshold) [0x0000c] in <9784853821ea47dbb6bb1f3e03091049>:0 
  at IronPython.Compiler.PythonScriptCode.CompileBody (Microsoft.Scripting.Ast.LightExpression`1[T] lambda) [0x00057] in <57a5bd653356491bba8a61ecf9211193>:0 
  at IronPython.Compiler.PythonScriptCode.EnsureTarget (System.Boolean register) [0x00015] in <57a5bd653356491bba8a61ecf9211193>:0 
  at IronPython.Compiler.PythonScriptCode.GetTarget (System.Boolean register) [0x00021] in <57a5bd653356491bba8a61ecf9211193>:0 
  at IronPython.Compiler.PythonScriptCode.RunWorker (IronPython.Runtime.CodeContext ctx) [0x00000] in <57a5bd653356491bba8a61ecf9211193>:0 
  at IronPython.Compiler.PythonScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00023] in <57a5bd653356491bba8a61ecf9211193>:0 
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x000c6] in <57a5bd653356491bba8a61ecf9211193>:0 
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <57a5bd653356491bba8a61ecf9211193>:0 
  at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope, Microsoft.Scripting.ErrorSink errorSink) [0x0001e] in <0d164baeace648b2930cfd25249cf9f3>:0 
  at Microsoft.Scripting.SourceUnit.Execute (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <0d164baeace648b2930cfd25249cf9f3>:0 
  at Microsoft.Scripting.Hosting.ScriptSource.Execute (Microsoft.Scripting.Hosting.ScriptScope scope) [0x00017] in <0d164baeace648b2930cfd25249cf9f3>:0 
  at (wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ScriptSource.Execute(Microsoft.Scripting.Hosting.ScriptScope)
  at **[CALLING OBJECT]**..ctor () [0x00020] in . . .

Any help or recommendations on project details I need to verify would be greatly appreciated. Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported call sequence, Python.CreateEngine() followed by engine.Execute(code, scope), in a Windows x64 .NET 4.7.2 project using the IronPython NuGet package. Review the Microsoft.Scripting and IronPython stack trace and verify the project and runtime details; done means identifying the cause of the PlatformNotSupportedException and documenting a confirmed resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.