VMProtect Ultimate v3.9.4 build 2305 - "Method not found" error

Hi,

I’m experiencing this error:
System.MissingMethodException: Method not found: ‘Microsoft.Extensions.DependencyInjection.ServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)’.

Which can be replicated by creating a blank console project in .NET 8.0 and adding the Nuget Package Microsoft.Extensions.DependencyInjection
Then I added these two lines:
static void Main(string args)
{
IServiceCollection services = new ServiceCollection();
ServiceProvider provider2 = ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(services);
Console.WriteLine(“Hello, World!”);
}

Then when I VMProtect the DLL and run it with the exe & runtime.json file with the protected DLL I encounter this error. I uploaded a sample project as reference.
VMPDependencyInjectTest.zip (5.15 MB)

Fixed in the 2325 build.

Hi,

I sent an updated project to you on telegram (31mb can’t attach on forums). I seem to be getting this exception now:

Unhandled exception. System.TypeInitializationException: The type initializer for ‘Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteTypeMappingSource’ threw an exception.
—> System.TypeLoadException: Method ‘ToJsonTyped’ in type ‘Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal.SqliteJsonByteArrayReaderWriter’ from assembly ‘Microsoft.EntityFrameworkCore.Sqlite, Version=9.0.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’ does not have an implementation.
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteByteArrayTypeMapping..ctor(String storeType, Nullable1 dbType) at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteTypeMappingSource..cctor() --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteTypeMappingSource..ctor(TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies) at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr)
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)

Fixed in the 2329 build.

P.S. Also don’t forget to put *.deps.json in the output folder.

Perfect that worked.