[Mono-dev] Searching the GAC w/ the embedded API

Robert Jordan robertj at gmx.net
Mon Apr 21 15:44:00 EDT 2008


Hi,

Casey Marshall wrote:
> I'm developing an application that will embed Mono, and I'd like to be
> able to find classes by name by searching what's installed in the GAC,
> instead of specifying the assembly to get the class from.
> 
> That is, I'm following the recipe from the embedding mono web page:
> 
>   - Create a domain.
>   - Load assemblies into that domain (by path).
>   - Get an image from that assembly.
>   - Load classes by name from that image.

This is fine if you load the classes by their type token.

> What I was wondering was whether or not there was a simpler way to load
> an assembly, or lookup a class, by simply querying the GAC instead of
> loading the requisite assemblies beforehand.
> 
> It's OK if the answer is "search the GAC yourself," I'm just curious
> what options there are.

Searching the GAC is not an option because it doesn't provide any
type info beyond the assembly name. Mono does not maintain a cache
of the types in the GAC.

> Also, is it possible to disable the crash dump in mono? I'm using
> abort() in a test suite, and it would be nice to not have a screenful of
> gdb info when a test fails.

Use assert(3) or glib's g_assert() instead.

Robert



More information about the Mono-devel-list mailing list