-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Unhandled exception. System.Reflection.CustomAttributeFormatException: 'AllowMultiple' property specified was not found. #113009
Comments
Do you use any trimming method? What is the configuration? |
Agree with @huoyaoyuan that this could be caused by trimming. Could you let us know if this is used? Also is it 100% repro or only sometimes? Also CC @steveharter in case it looks like a problem with reflection invoke. |
I checked all csproj files in the project and did not use any PublishTrimmed configuration |
I checked all csproj files in the project and did not use any PublishTrimmed configuration. In the environment I described, this error is 100% likely to recur. |
Can you share a simplified repro project for the issue? Is your deployed assembly file broken? You can inspect with tools like ILSpy and check if anything is broken. |
This issue has been marked |
Description
My operating environment is the virtual machine Anolis OS 8.9 (Linux x64), Basic image using aspnet: 9.0. I cross compile an arm64 architecture image using Docker Buildx and start container testing using the following command.
docker run -d -p 8080:8080 -e ASPNETCORE_URLS= http://0.0.0.0:8080 -v /home/zytek/publish/appsettings.json:/ home/zytek/app/appsettings.json -v /home/zytek/publish/Logs:/home/zytek/app/Logs -v /home/zytek/publish/config.json:/home/zytek/app/wwwroot/app/config.json -v /etc/localtime:/etc/localtime:ro --name=data-analytics-platform --platform=linux/arm64 mirrors.ziyitek.cn/library/data-analytics-platform:latest-arm64
The following is a detailed stack:
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at InvokeStub_AttributeUsageAttribute.set_AllowMultiple(Object, Object, IntPtr*)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span
1 copyOfArgs, BindingFlags invokeAttr) --- End of inner exception stack trace --- at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span
1 copyOfArgs, BindingFlags invokeAttr)at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder
1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder
1 derivedAttributes)--- End of inner exception stack trace ---
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder
1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder
1 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 System.Attribute.InternalGetAttributeUsage(Type type)
at System.Attribute.InternalParamGetCustomAttributes(ParameterInfo param, Type type, Boolean inherit)
at Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes.GetAttributesForParameter(ParameterInfo parameterInfo, Type modelType)
at Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataProvider.CreateParameterDetails(ModelMetadataIdentity key)
at Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataProvider.CreateCacheEntry(ModelMetadataIdentity key)
at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func
2 valueFactory)at Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataProvider.GetMetadataForParameter(ParameterInfo parameter, Type modelType)
at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultApplicationModelProvider.CreateParameterModel(ParameterInfo parameterInfo)
at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultApplicationModelProvider.OnProvidersExecuting(ApplicationModelProviderContext context)
at Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelFactory.CreateApplicationModel(IEnumerable
1 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.ChangeTokenRegistration
1..ctor(Func1 changeTokenProducer, Action
1 changeTokenConsumer, TState state)at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.Subscribe()
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllers(IEndpointRouteBuilder endpoints)
at ZyTek.Framework.API.ApiRegister.UseFramework(WebApplication app) in /home/zytek/src/ZyTek.Framework.API/ApiRegister.cs:line 125
at ZyTek.DataAnalyticsPlatform.WebAPI.Host.Program.Main(String[] args) in /home/zytek/src/ZyTek.DataAnalyticsPlatform.WebAPI.Host/Program.cs:line 1
The Docker information of the host machine is as follows:
[zytek@anolis ~]$ docker info
Client:
Version: 27.4.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.20.0
Path: /home/zytek/.docker/cli-plugins/docker-buildx
Server:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 6
Server Version: 27.4.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 88bf19b2105c8b17560993bee28a01ddc2f97182
runc version: v1.2.3-0-g0d37cfd
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 5.10.134-16.2.an8.x86_64
Operating System: Anolis OS 8.9
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.609GiB
Name: anolis.slave01
ID: 5fb6542b-df47-4eac-8c71-0b06ddc7aa2c
Docker Root Dir: /data/docker_storage
Debug Mode: false
Experimental: false
Insecure Registries:
mirrors.ziyitek.cn
127.0.0.0/8
Registry Mirrors:
https://docker.1ms.run/
https://docker.xuanyuan.me/
Live Restore Enabled: true
Product License: Community Engine
Execute commands inside the container:
zytek@ac0380e33582:~/app$ dotnet --info
Host:
Version: 9.0.2
Architecture: arm64
Commit: 80aa709
RID: linux-arm64
.NET SDKs installed:
No SDKs were found.
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Reproduction Steps
Expected behavior
execute normally
Actual behavior
execute normally
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: