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

Casey Marshall cmarshall at pacificbiosciences.com
Mon Apr 21 15:55:30 EDT 2008

On Mon, 2008-04-21 at 21:44 +0200, Robert Jordan wrote:
> 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, I was wondering (but didn't ask it that well) if it's possible to
load an assembly by name, e.g., just "foo.bar.dll" or "foo.bar", if that
assembly is in the GAC, or maybe a location in MONO_PATH, instead of
giving the full path to the DLL.

> > 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.

Oh, oops, I mean I'm using assert. Sorry. This is raising SIGABRT on
failed assertions, and I get the debug dump when using that. So do you
mean "use g_assert" instead?


More information about the Mono-devel-list mailing list