Multiple custom attributes of the same type found
Problem:
When trying to identify the anonymous contact, Sitecore throws exception and unable to identify the contact. Tracking is enabled and xconnect is working fine. Below is the inner exception I am getting-
InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "Multiple custom attributes of the same type found.",
"ExceptionType": "System.Reflection.AmbiguousMatchException",
"StackTrace": " at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)\r\n at System.Runtime.InteropServices.RuntimeInformation.get_FrameworkDescription()\r\n at Sitecore.Xdb.Collection.Data.SqlServer.Managers.ChangeTracking.SyncToken.AllowedTypesValidatorSerializationBinder..cctor()"
}
Solution:
I raised this issue to Sitecore support. As per them this issue is because the logic under the 'Sitecore.Xdb.Collection.....AllowedTypesValidatorSerializationBinder' and it will get the FrameworkDescription from the RuntimeInformation , Sitecore has the following code lines:
from the System.Runtime.InteropServices.RuntimeInformation:
get
{
if (s_frameworkDescription == null)
{
AssemblyFileVersionAttribute assemblyFileVersionAttribute = (AssemblyFileVersionAttribute)typeof(object).GetTypeInfo().Assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute));
s_frameworkDescription = string.Format("{0} {1}", ".NET Core", assemblyFileVersionAttribute.Version);
}
return s_frameworkDescription;
}
This code is implemented by Microsoft and used to get the running .net core, .net Framework version, from here it will try to get the custom attributes where eventually it will face the error of 'Multiple custom attributes of the same type found' , the issue happens since the mscorlib assembly has more than one AssemblyFileVersionAttribute attribute.
From the Internet articles, I can see that the issue happens when some monitoring software is in place and injects extra information into the assembly
So I checked if the below dll is present in the following path :
C:\Program Files\Microsoft Monitoring Agent\Agent\APMDOTNETAgent\V8.0.13053.0\StubProfiler64.dll
Please note that the version might be different and may not be necessarily 'V8.0.13053.0'.
I found the dll there and I disabled the dll and that fixed the issue.
Comments
Post a Comment