"MissingMethodException: .ctor" exception occured while updating to OrchardCore version 1.9.0-preview-18162
Describe the bug
"MissingMethodException: .ctor" exception occured while updating to OrchardCore version 1.9.0-preview-18162
To Reproduce
Steps to reproduce the behavior:
- Open the project that can run normally in OrchardCore version 1.7.2
- Update OrchardCore version of the project to 1.9.0-preview-18162
- Run the project
- The browser display error as follow:
An unhandled exception occurred while processing the request. MissingMethodException: .ctor System.RuntimeMethodHandle.IsCAVisibleFromDecoratedType(QCallTypeHandle attrTypeHandle, RuntimeMethodHandleInternal attrCtor, QCallTypeHandle sourceTypeHandle, QCallModule sourceModule)
Stack Query Cookies Headers Routing MissingMethodException: .ctor System.RuntimeMethodHandle.IsCAVisibleFromDecoratedType(QCallTypeHandle attrTypeHandle, RuntimeMethodHandleInternal attrCtor, QCallTypeHandle sourceTypeHandle, QCallModule sourceModule) System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, ref MetadataImport scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, bool mustBeInheritable, ref ListBuilder
Show raw exception details
System.MissingMethodException: .ctor
at System.RuntimeMethodHandle.IsCAVisibleFromDecoratedType(QCallTypeHandle attrTypeHandle, RuntimeMethodHandleInternal attrCtor, QCallTypeHandle sourceTypeHandle, QCallModule sourceModule)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder1 derivedAttributes) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultApplicationModelProvider.CreateControllerModel(TypeInfo typeInfo) at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultApplicationModelProvider.OnProvidersExecuting(ApplicationModelProviderContext context) at Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelFactory.CreateApplicationModel(IEnumerable1 controllerTypes)
at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetDescriptors()
at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection()
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize()
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.GetChangeToken()
at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration1..ctor(Func1 changeTokenProducer, Action1 changeTokenConsumer, TState state) at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func1 changeTokenProducer, Action changeTokenConsumer)
at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.Subscribe()
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapDynamicControllerRoute[TTransformer](IEndpointRouteBuilder endpoints, String pattern, Object state)
at OrchardCore.HomeRoute.Startup.Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
at OrchardCore.Modules.ShellPipelineExtensions.ConfigurePipelineAsync(IApplicationBuilder builder)
at OrchardCore.Modules.ShellPipelineExtensions.BuildPipelineInternalAsync(ShellContext context)
at OrchardCore.Modules.ShellPipelineExtensions.BuildPipelineAsync(ShellContext context)
at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext)
at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<<Invoke>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell)
at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell) at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func2 execute, Boolean activateShell)
at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Screenshots
1.8.0+ brings breaking changes, including targeting .NET 8, see the release notes. Did you first upgrade your app to v1.8.2?
Hi @Piedone ,
My app can run normally while upgrading to 1.8.2
Since this doesn't reproduce with the latest source, I assume there's something particular with your setup. Can you check the exception details to see if it shows which type exactly is affected? From what I can tell, there is some issue with an attribute on a model (controller?) class not having a (I guess public) constructor.
Hi @Piedone , Sorry,I can't find location of exception.
I am currently using version 1.8.2 for development and it is running normally.
I mean, you can attach the debugger (like from Visual Studio) and make the exception appear there. Then, the details of the exception object (specifically ClassName) should tell where exactly is the method missing.
@ODA669 since you have this under https://github.com/OrchardCMS/OrchardCore/discussions/15720, could you please provide the info I asked for in my previous comment above?
I mean, you can attach the debugger (like from Visual Studio) and make the exception appear there. Then, the details of the exception object (specifically
ClassName) should tell where exactly is the method missing.
Hi,
Visual studio debugger don't tell me the details of the exception object (specifically ClassName), maybe because the project refference OrchardCore nuget package .
I see. I don't think we'll be able to help you without more information. Can you perhaps share the code somewhere?
@effapp?
Clean your repository and rebuild, this will get rid of older dlls.