Mono.Cecil 0.9.5.3을 사용하고 VS2012 RC (.NET 4.0 System.XML.DLL이 .NET 4.5 버전으로 대체 됨)를 설치 한 후 일부 코드에서 System.ArugmentException이 발생합니다. 각 메소드의 사용자 정의 속성을 반복합니다. 어떤 경우에는 Type이어야하는 AsyncStateMachine
속성의 ctor 인수가 비어있는 것으로 나타납니다.System.Xml DLL의 .NET 4.5 버전을 분석 할 때 Mono.Cecil 예외가 throw되는 이유는 무엇입니까?
다음 코드 조각을 재생하기 :
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; // <---- this line throws an ArgumentException
예외는 내 질문은
Mono.Cecil.ModuleDefinition.CheckFullName(string fullName = "")
에서 발생합니다 - Mono.Cecil 버그, 또는에서 System.Xml이있다. DLL? 스펙에 "빈"유형이 ctor 인수로 표시 될 수 있습니까?
완료 (https://github.com/jbevain/cecil/issues/102) 감사합니다. –
@OmerRaviv이 문제를 해결해 주셔서 고맙습니다! –