[Mono-bugs] [Bug 513633] New: [SRE] DefineManifestResource does not handle disposed files
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Jun 16 13:10:17 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=513633
Summary: [SRE] DefineManifestResource does not handle disposed
files
Classification: Mono
Product: Mono: Class Libraries
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: rkumpera at novell.com
ReportedBy: msafar at novell.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.IO;
class ResourceEmitter
{
public static void Main ()
{
string assemblyName = "temp";
AssemblyBuilder asmb = AppDomain.CurrentDomain.DefineDynamicAssembly
(new AssemblyName (assemblyName), AssemblyBuilderAccess.RunAndSave);
ModuleBuilder mod = asmb.DefineDynamicModule (assemblyName,
assemblyName + ".exe");
// Embed "resource blob"
CreateFile ("broken.file");
for (int i = 0; i < 1000; ++i) {
using (var fs = new FileStream ("broken.file", FileMode.Open))
mod.DefineManifestResource ("broken.file", fs,
ResourceAttributes.Public);
}
asmb.Save (assemblyName + ".exe");
}
public static void CreateFile (string filename, params string[] contents)
{
using (TextWriter tw = new StreamWriter (filename)) {
foreach (string s in contents)
tw.WriteLine (s);
}
}
}
Executed on Mono:
No error
Executed on .NET
Unhandled Exception: System.ObjectDisposedException: Cannot access a closed
file.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list