Using third-party library in .NET 6.0

Dave BLT 1 Reputation point
2021-11-10T17:07:36.353+00:00

We're trying to migrate our WPF app to .NET 6.0 and keep getting a MissingMethodException for DefineDynamicAssembly when calling into an old, obfuscated third-party library we currently depend on. The library appears to be built on .NET 3.5.

The closest-sounding thing we googled for was a Stack Overflow post (link) about System.Reflection.Emit, but we do not have the source code for the third-party library.

We are hoping there might be a way to finesse the library into working. Can anyone please offer insights?

Just to be clear, we don't care about deobfuscating the assembly. We just want it to work.

System.TypeInitializationException HResult=0x80131534 Message=The type initializer for 'A.c9a060eaf30c717bf2a2d42ef6a110a47' threw an exception. Source=assemblyName StackTrace: at A.c9a060eaf30c717bf2a2d42ef6a110a47.c8e61c0abc97221f783661115e77d8d32() at ThirdParty.Library.Repository.get_Default()

Inner Exception 1: TypeInitializationException: The type initializer for 'A.c11a752a126c751be2ef161586727cc33' threw an exception.

Inner Exception 2: MissingMethodException: Method not found: 'System.Reflection.Emit.AssemblyBuilder System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)'.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,670 questions
{count} votes