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

Switching project from .net 8 to 9 will cause input function to throw ArgumentException #1811

Closed
3 tasks done
eugenelepekhin opened this issue Nov 16, 2024 · 7 comments
Closed
3 tasks done

Comments

@eugenelepekhin
Copy link

Prerequisites

.net 8 and .net 9 application with embedded IronPython3

The issue tracker is used to report bugs and request new features, NOT to ask questions.

Questions should be posted in Discussions or to the users mailing list which can be accessed at
https://ironpython.groups.io/g/users.

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

Description

I have an application with embedded IronPython. When I build it with .net 8 it works fine. However, if I build it with .net 9 the input() function will throw an exception:
System.ArgumentException: Type doesn't have a method with a given name and signature. (Parameter 'type')
Here is the call stack:
at Microsoft.Scripting.Utils.ContractUtils.Requires(Boolean precondition, String paramName, String message)
at Microsoft.Scripting.Generation.ILGen.EmitCall(Type type, String name, Type[] paramTypes)
at IronPython.Runtime.Types.NewTypeMaker.ImplementCTDOverride(MethodInfo m)
at IronPython.Runtime.Types.NewTypeMaker.ImplementCustomTypeDescriptor()
at IronPython.Runtime.Types.NewTypeMaker.ImplementPythonObject()
at IronPython.Runtime.Types.NewTypeMaker.ImplementType()
at IronPython.Runtime.Types.NewTypeMaker.CreateNewType()
at IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass24_0.b__0()
at Microsoft.Scripting.Utils.Publisher2.GetOrCreateValue(TKey key, Func1 create)
at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String typeName, PythonTuple bases)
at IronPython.Runtime.Types.PythonType.InitializeUserType(CodeContext context, String name, PythonTuple bases, PythonDictionary vars, String selfNames)
at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, String name, PythonTuple bases, PythonDictionary dict, String selfNames)
at IronPython.Runtime.Types.PythonType.new(CodeContext context, PythonType cls, String name, PythonTuple bases, PythonDictionary dict, String selfNames)
at IronPython.Runtime.Operations.PythonOps.MakeClass(FunctionCode funcCode, Func2 body, CodeContext parentContext, String name, PythonTuple bases, PythonDictionary keywords, String selfNames) at Microsoft.Scripting.Interpreter.FuncCallInstruction8.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
at IronPython.Runtime.ZipImportModule.zipimporter.load_module(CodeContext context, String fullname)
at Microsoft.Scripting.Interpreter.FuncCallInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in /_/src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 376 at Microsoft.Scripting.Interpreter.FuncCallInstruction6.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at IronPython.Runtime.PythonContext.Call(CodeContext context, Object func, Object arg0)
at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter(CodeContext context, Object importer, String fullName, PythonList path, Object& ret)
at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, PythonList path, Func5 defaultLoader) at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, PythonList path) at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name) at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level) at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level) at Microsoft.Scripting.Interpreter.FuncCallInstruction7.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run8[T0,T1,T2,T3,T4,T5,T6,T7,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext context, String fullName, Int32 level)
at Microsoft.Scripting.Interpreter.FuncCallInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at IronPython.Compiler.PythonScriptCode.Run(Scope scope) at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) at IronPython.Runtime.ZipImportModule.zipimporter.load_module(CodeContext context, String fullname) at Microsoft.Scripting.Interpreter.FuncCallInstruction4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in //src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 418
at Microsoft.Scripting.Interpreter.FuncCallInstruction6.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at IronPython.Runtime.PythonContext.Call(CodeContext context, Object func, Object arg0) at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter(CodeContext context, Object importer, String fullName, PythonList path, Object& ret) at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, PythonList path, Func5 defaultLoader)
at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, PythonList path)
at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
at IronPython.Runtime.PythonContext.EnsureEncodings()
at IronPython.Runtime.Operations.PythonOps.LookupEncoding(CodeContext context, String encoding)
at IronPython.Modules.PythonIOModule.TextIOWrapper.GetDecoder(CodeContext context)
at IronPython.Modules.PythonIOModule.TextIOWrapper.readline(CodeContext context, Int32 limit)
at Microsoft.Scripting.Interpreter.FuncCallInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in /_/src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 418 at IronPython.Runtime.PythonContext.CallSplat(CodeContext context, Object func, Object[] args) at IronPython.Runtime.Operations.PythonCalls.Call(CodeContext context, Object func, Object[] args) at IronPython.Runtime.Operations.PythonOps.Invoke(CodeContext context, Object target, String name, Object[] args) at IronPython.Runtime.Operations.PythonOps.ReadLine(CodeContext context, Object f) at IronPython.Runtime.Operations.PythonOps.ReadLineFromSrc(CodeContext context, Object src) at IronPython.Modules.Builtin.input(CodeContext context, Object prompt) at Microsoft.Scripting.Interpreter.FuncCallInstruction3.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in /
/src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 418
at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
at Microsoft.Scripting.SourceUnit.Execute(Scope scope)
at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String expression, ScriptScope scope)
at LogicCircuit.IronPythonConsole.<>c__DisplayClass26_0.g__run|0() in C:\Projects\LogicCircuit\LogicCircuit\master\Sources\LogicCircuit\Dialog\IronPythonConsole.xaml.cs:line 166

[Description of the bug or feature]

Steps to Reproduce

I've actually build a small project to repro this. please see the attached.

  1. Build the provided solution
  2. with default .net 8 it should work.
  3. Change TargetFramework to .net 9
  4. Rebuild and run.

Expected behavior:

[What you expected to happen]
Expecting the program to work without exceptions.

Actual behavior:
throws

  • .NET platform used (choice from: .NET, .NET Core, .NET Framework, Mono, Unity, Xamarin),
  • Version of the .NET platform used,
  • Operating system used: win 10
  • Value of sys.version, from imported module sys.

IronPythonErrorTest.zip

@slozier
Copy link
Contributor

slozier commented Nov 17, 2024

Thanks for the report. This should be resolved by the .NET 9 fix included in #1807.

@djymdmannen
Copy link

We've encountered this error in our project as well. Before we decide whether we need to revert to .NET 8 or not, I'm wondering if you have any additional details about when a potential fix might be available?

@slozier
Copy link
Contributor

slozier commented Nov 24, 2024

We've encountered this error in our project as well. Before we decide whether we need to revert to .NET 8 or not, I'm wondering if you have any additional details about when a potential fix might be available?

I don't have a specific date, but I'm planning a release within the next few weeks.

@eugenelepekhin
Copy link
Author

Any updates on ETA?

@slozier
Copy link
Contributor

slozier commented Dec 19, 2024

Any updates on ETA?

Yes, today assuming no issues during testing.

@slozier
Copy link
Contributor

slozier commented Dec 20, 2024

@slozier slozier closed this as completed Dec 20, 2024
@eugenelepekhin
Copy link
Author

That works, thanks

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

No branches or pull requests

3 participants