Hi JB,
I am using Mono Cecil version 0.11.3.0 to read .Net Core 3.1 assembly. Here
is the line of code, that is throwing an exception.
var assembly = AssemblyDefinition.ReadAssembly(assemblyPath, new
ReaderParameters { ReadSymbols = true });
Exception:
System.BadImageFormatException: 'Format of the executable (.exe) or library
(.dll) is invalid.'
Can you please help? (Above line of code is working fine for .Net 4.0)
Regards,
Venu
On Thu, Apr 11, 2019 at 4:00 PM venu gopal Yela <[email protected]>
wrote:
> Thanks JB. I have choosen pdb only option and version 0.9 worked for me.
> In case portable pdb is required I will move to version .10.
>
> Regards,
> Venu
>
> On Tue, 9 Apr 2019, 01:24 Jb Evain, <[email protected]> wrote:
>
>> Hello,
>>
>> You're probably facing a portable pdb, which are not supported in 0.9. I
>> suggest you move to 0.10, please look at http://cecil.pe as it contains
>> information about the breaking changes.
>>
>> Jb
>>
>> On Mon, Apr 8, 2019 at 6:47 AM venu gopal Yela <[email protected]>
>> wrote:
>>
>>> Hi JB,
>>>
>>> I am using Mono Cecil 0.9.6 version to add MSIL (loggers) on .Net Core.
>>> assembly.
>>>
>>> Here is the code I am using to read assembly.
>>> AssemblyDefinition.ReadAssembly(targetPhysicalPath, new ReaderParameters
>>> { AssemblyResolver = resolver, ReadSymbols = true });
>>>
>>>
>>> when ReadSymbols is not passed to ReaderParameters(), assembly is loaded
>>> fine. Below code is working fine.
>>>
>>> AssemblyDefinition.ReadAssembly(targetPhysicalPath, new ReaderParameters
>>> { AssemblyResolver = resolver });
>>>
>>>
>>> Exception stack trace is given below: Can you please help? (Above code
>>> is working fine for .Net 4.0)
>>>
>>> --------------------------------------
>>>
>>> at Microsoft.Cci.Pdb.MsfDirectory..ctor(PdbReader reader,
>>> PdbFileHeader head, BitAccess bits)
>>> at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, Dictionary`2&
>>> tokenToSourceMapping, String& sourceServerData, Int32& age, Guid& guid)
>>> at Mono.Cecil.Pdb.PdbReader.PopulateFunctions()
>>> at Mono.Cecil.Pdb.PdbReader.ProcessDebugHeader(ImageDebugDirectory
>>> directory, Byte[] header)
>>> at Mono.Cecil.ModuleDefinition.ProcessDebugHeader()
>>> at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader)
>>> at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module,
>>> ReaderParameters parameters)
>>> at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image,
>>> ReaderParameters parameters)
>>> at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream,
>>> ReaderParameters parameters)
>>> at Mono.Cecil.ModuleDefinition.ReadModule(String fileName,
>>> ReaderParameters parameters)
>>> at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName,
>>> ReaderParameters parameters)
>>>
>>> ------------------------------------------
>>>
>>> ------------------------------------------
>>>
>>>
>>> Thanks & Regards,
>>>
>>> Venu
>>>
>>> --
>>> --
>>> --
>>> mono-cecil
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "mono-cecil" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> --
>> --
>> mono-cecil
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "mono-cecil" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/mono-cecil/AhfCDjwZcfk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
--
--
mono-cecil
---
You received this message because you are subscribed to the Google Groups
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mono-cecil/CAH4RsGsC9sbMJhY%2BJ%2BVKD4Y6-cVPzfnO4QiOUprB4G42h7wQJg%40mail.gmail.com.