Skip to content

.net 11 preview 7 and Assembly.GetCallingAssembly() #2740

Description

@flucas1

Starting with .net 11 preview 7 I get this error

System.NotSupportedException: Unable to retrieve stack trace information when StackTraceSupport feature switch is set to false.
   at System.Reflection.Assembly.GetCallingAssembly()
   at System.Reflection.Emit.AssemblyBuilder.DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access)
   at Python.Runtime.ReflectionPolyfills.DefineDynamicAssembly(AppDomain _, AssemblyName assemblyName, AssemblyBuilderAccess assemblyBuilderAccess)
   at Python.Runtime.CodeGenerator..ctor()
   at Python.Runtime.DelegateManager..ctor()
   at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs)
   at Python.Runtime.PythonEngine.Initialize(Boolean setSysArgv, Boolean initSigs)
   at Python.Runtime.PythonEngine.Initialize()

The root cause seems to be this breaking change
dotnet/docs#54566

And the overloads used for AssemblyBuilder.DefineDynamicAssembly
https://github.com/dotnet/dotnet/blob/main/src/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeAssemblyBuilder.cs#L24

I would think that using some other overload passing an assembly name explicitly or fallback, should do the work.

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