Yep got it ...
Resolved with two extension methods around Resolve...
public static TypeDefinition ThreadSafeResolve(this TypeReference
reference)
{
lock(reference.Module)
{
return reference.Resolve();
}
}
public static MethodDefinition ThreadSafeResolve(this
MethodReference reference)
{
lock (reference.Module)
{
return reference.Resolve();
}
}
easy enough. Although I could probably make this more performance by
checking first if they already are Type/Method Definitions ...
eg: add
var def = reference as MethodDefinition;
if(def != null) return def;
Cheers,
Greg
On Thu, Dec 16, 2010 at 12:08 PM, Jb Evain <[email protected]> wrote:
> On Thu, Dec 16, 2010 at 6:04 PM, Greg Young <[email protected]>
> wrote:
> > Each has their own assembly resolver.
> > I load each independently (this is occurring later calling a resolve
> where I
> > am no longer thread per module but I figured things would be loaded at
> that
> > point).
> >
> > My guess is that they are not, and I need to lock myself at that point on
> > module.
>
> As Cecil loads pretty much everything on demand, you have to take care
> of that. You can try to use ReadingMode.Immediate when reading your
> modules to avoid the lazy loading.
>
> If you crash in the MetadataReader, it means that multiple threads are
> triggering loads from the same module.
>
> --
> --
> mono-cecil
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer de
votre attention
--
--
mono-cecil