Hello mono-addins team!,
I tried to update the Addins system of the software I'm developing. After updating to mono.Addins 0.6 and 0.6.2 I noticed that, in Windows, the addins engine fails to scan assemblies under Windows and generates errors like the following:
Scanning file: ...\...\mydll.dll
Using assembly reflector: Mono.Addins.CecilReflector.Reflector
Error:There was an error while scanning assembly: ...\...\mydll.dll
ExceptionSystem.TypeInitializationException: The type initializer for
'Mono.Cecil.Metadata.TableHeap' threw an exception. --->
System.ArgumentException: Value does not fall within the expected range.
at System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(Array array, RuntimeFieldHandle fldHandle)
at Mono.Cecil.Metadata.TableHeap..cctor()
--- End of inner exception stack trace ---
at Mono.Cecil.Metadata.TableHeap..ctor(Section section, UInt32 start, UInt32 size)
at Mono.Cecil.PE.ImageReader.ReadMetadataStream(Section section)
at Mono.Cecil.PE.ImageReader.ReadMetadata()
at Mono.Cecil.PE.ImageReader.ReadImage()
at Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)
at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at Mono.Addins.CecilReflector.Reflector.LoadAssembly(String file, Boolean cache)
at Mono.Addins.CecilReflector.Reflector.LoadAssembly(String file)
at Mono.Addins.Database.AddinScanner.GetReflector(IProgressStatus monitor, AddinScanResult scanResult, String filePath)
at Mono.Addins.Database.AddinScanner.ScanAssembly(IProgressStatus
monitor, String filePath, AddinScanResult scanResult,
AddinDescription& config)
Stack at Mono.Cecil.Metadata.TableHeap..ctor(Section section, UInt32 start, UInt32 size)
at Mono.Cecil.PE.ImageReader.ReadMetadataStream(Section section)
at Mono.Cecil.PE.ImageReader.ReadMetadata()
at Mono.Cecil.PE.ImageReader.ReadImage()
at Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)
at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at Mono.Addins.CecilReflector.Reflector.LoadAssembly(String file, Boolean cache)
at Mono.Addins.CecilReflector.Reflector.LoadAssembly(String file)
at Mono.Addins.Database.AddinScanner.GetReflector(IProgressStatus monitor, AddinScanResult scanResult, String filePath)
at Mono.Addins.Database.AddinScanner.ScanAssembly(IProgressStatus
monitor, String filePath, AddinScanResult scanResult,
AddinDescription& config)
I saw that the cecil library have been updated into Mono.Addins on the February 23, 2011 and this cecil error manifested to others using cecil 0.9.4: see
http://groups.google.com/group/mono-cecil/browse_thread/thread/952387ac994e47cf?pli=1
I noticed that the problem does not manifest if I recompile mono addins using the latest stable cecil library 0.9.5.
My intention is only to share this information, hoping it's usefulness.
Best,
Matteo