mono / mono-addins

Mono.Addins is a generic framework for creating extensible applications, and for creating add-ins which extend those applications.
MIT License
163 stars 94 forks source link

Silently ignore native binaries during scanning #58

Closed KirillOsenkov closed 7 years ago

KirillOsenkov commented 7 years ago

Mono Addins crashes when encountering a native binary that's not excluded. Maybe it should instead skip it silently?

Therzok commented 7 years ago

Cecil throws a BadImageFormatException when it encounters a native library (CLI Header is empty). Maybe we should catch that, and log the assembly not being loaded.

KirillOsenkov commented 7 years ago

Ideally avoid the exception in the first place (I bet Cecil has ways to probe)

Therzok commented 7 years ago

Doesn't look like it does, but this is part of parsing the metadata of a given dll file, so we can safely just catch that exception.

KirillOsenkov commented 7 years ago

@jbevain Jb is there a way to detect a native binary in Cecil and avoid throwing an exception?

KirillOsenkov commented 7 years ago

Here's how I normally do it: https://github.com/KirillOsenkov/SourceBrowser/blob/master/src/Common/IsManagedAssembly.cs

Therzok commented 7 years ago

Closing as https://github.com/mono/mono-addins/pull/63 was merged.