On 18 Mai, 12:35, Jb Evain <
j...@nurv.fr> wrote:
> On Mon, May 17, 2010 at 7:17 PM, Jan <
jan.blessen...@gmail.com> wrote:
> > More info: VS2010 32 bit .net 4.0 vm, if I configure the same for my
> > exe it works. Can that be a rights problem?
>
> It's possible. VS sometimes hold locks on files. But the exception
> seems to say that the pdb writer is closing an unopen method, or that
> something went from when writing a method information.
>
> Do you have a small repro?
I have no repro because it only happens inside the vm hosted inside
vs2010. I was not able to debug the unmanaged code to get more info.
The file that I am trying to write is not there. And I was able to
write the assembly itself, only problems with the pdb file.
In this error case you are also locking the pdb file on the drive. Can
I get a try..finally like this:
sealed class ModuleWriter {
public static void WriteModuleTo (ModuleDefinition module, Stream
stream, WriterParameters parameters)
{
if ((module.Attributes & ModuleAttributes.ILOnly) == 0)
throw new ArgumentException ();
if (module.HasImage && module.ReadingMode == ReadingMode.Deferred)
ImmediateModuleReader.ReadModule (module);
module.MetadataSystem.Clear ();
var fq_name = stream.GetFullyQualifiedName ();
var symbol_writer_provider = parameters.SymbolWriterProvider;
if (symbol_writer_provider == null && parameters.WriteSymbols)
symbol_writer_provider = SymbolProvider.GetPlatformWriterProvider
();
var symbol_writer = GetSymbolWriter (module, fq_name,
symbol_writer_provider);
#if !SILVERLIGHT && !CF
if (parameters.StrongNameKeyPair != null && module.assembly !=
null) {
var name =
module.assembly.Name;
name.PublicKey = parameters.StrongNameKeyPair.PublicKey;
name.HasPublicKey = true;
module.Attributes |= ModuleAttributes.StrongNameSigned;
}
#endif
var metadata = new MetadataBuilder (module, fq_name,
symbol_writer_provider, symbol_writer);
try
{
BuildMetadata(module, metadata);
if (module.SymbolReader != null)
module.SymbolReader.Dispose();
var writer = ImageWriter.CreateWriter(module,
metadata, stream);
writer.WriteImage();
#if !SILVERLIGHT && !CF
if (parameters.StrongNameKeyPair != null)
CryptoService.StrongName(stream, writer,
parameters.StrongNameKeyPair);
#endif
}
finally
{
if (symbol_writer != null)
symbol_writer.Dispose();
}
}
I will try to debug more.
Jan
--
--
mono-cecil