AmbiguousMatchException: Multiple custom attributes of the same type found.
See original GitHub issueI’m using XmlSerializer
app.UseSoapEndpoint<IcTransactionService>("/services/IcTransactionService", new BasicHttpBinding(), SoapSerializer.XmlSerializer, true);
and my request object contains multiple xmlelement’s attributes like
[System.Xml.Serialization.XmlElementAttribute("Element1", typeof(ClassType1), Order=4)] [System.Xml.Serialization.XmlElementAttribute("Element2", typeof(ClassType2), Order=4)]
I got this exceptions once I pulled wsdl
An unhandled exception occurred while processing the request. AmbiguousMatchException: Multiple custom attributes of the same type found. System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, bool inherit)
Stack Query Cookies Headers Routing AmbiguousMatchException: Multiple custom attributes of the same type found. System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, bool inherit) System.Reflection.CustomAttributeExtensions.GetCustomAttribute<T>(MemberInfo element) SoapCore.Meta.MetaBodyWriter.AddSchemaTypeProperty(XmlDictionaryWriter writer, PropertyInfo property, TypeToBuild parentTypeToBuild) SoapCore.Meta.MetaBodyWriter.AddSchemaComplexType(XmlDictionaryWriter writer, TypeToBuild toBuild) SoapCore.Meta.MetaBodyWriter.AddTypes(XmlDictionaryWriter writer) SoapCore.Meta.MetaBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer) System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer) System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer) System.ServiceModel.Channels.Message.WriteBodyContents(XmlDictionaryWriter writer) SoapCore.Meta.MetaMessage.OnWriteBodyContents(XmlDictionaryWriter writer) System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer) System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writer) System.ServiceModel.Channels.Message.WriteMessage(XmlWriter writer) SoapCore.MessageEncoder.SoapMessageEncoder.WriteXmlCore(Message message, XmlWriter xmlWriter) SoapCore.MessageEncoder.SoapMessageEncoder.WriteMessageAsync(Message message, PipeWriter pipeWriter) SoapCore.SoapEndpointMiddleware<T_MESSAGE>.ProcessMeta(HttpContext httpContext) SoapCore.SoapEndpointMiddleware<T_MESSAGE>.ProcessOperation(HttpContext httpContext, IServiceProvider serviceProvider) SoapCore.SoapEndpointMiddleware<T_MESSAGE>.Invoke(HttpContext httpContext, IServiceProvider serviceProvider) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (4 by maintainers)
You are right, I found another properties which contains multiple XmlElement attributes. And I can confirm the described case doesn’t throw an exception anymore.
Let me cover all properties with XmlChoice approach and I let you know. Thanks
This issue was closed because it has been inactive for 14 days since being marked as stale.