Hey,

On Tue, Sep 14, 2010 at 12:22 AM, Fred <[email protected]> wrote:
> asmDef.MainModule.AssemblyReferences.Remove(asmRefName);

So far so good :)

>                asmDef.Write(newFn); // throws exception
>                asmDef.MainModule.Write("test.txt"); // also throws
> exception

Well, both are doing exactly the same thing for assemblies with a
single module, so it's not entirely surprising that the second "also
throws" :)

> System.ArgumentOutOfRangeException: Specified argument was out of the
> range of valid values.

Albeit being an horrible message, it simply means that you're removing
a reference that is still used from within the module. So you still
have a type that has the assembly reference you removed as a scope. In
any case, it needs to be fixed before writing the module if you want
to have a valid assembly.

-- 
Jb Evain  <[email protected]>

-- 
--
mono-cecil

Reply via email to