I use Mono.Cecil 0.9.5.3, and after installing VS2012 RC (which leads to replacing .NET 4.0 System.XML.DLL with its .NET 4.5 instance), I get a System.ArugmentException exception in some code that iterates user attributes each method. It seems that the reason is that in some cases the attribute ctor attribute AsyncStateMachine, which should be a type, is empty.
The following code snippet reproduces it:
string path = Assembly.Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").Location;
AssemblyDefinition systemXmlAssembly = AssemblyDefinition.ReadAssembly(path);
var query =
from ModuleDefinition module in systemXmlAssembly.Modules
from TypeDefinition td in module.Types
from MethodDefinition method in td.Methods
from CustomAttribute att in method.CustomAttributes
where method.Name == "System.Xml.IDtdParser.ParseInternalDtdAsync" &&
att.AttributeType.Name == "AsyncStateMachineAttribute"
select att;
CustomAttribute attribute = query.Single();
var args = attribute.ConstructorArguments;
Exception selected from
Mono.Cecil.ModuleDefinition.CheckFullName(string fullName = "")
My question is a bug in Mono.Cecil or System.Xml.DLL? Does the specification contain an "empty" type displayed as the ctor argument?
source
share