I found a strange behavior with this code:
using System; using System.Drawing; using System.Resources; using System.Reflection;
namespace ResourceTests
{
/// <summary>
/// Gives an exception when trying to access
/// an embedded resource.
/// </summary>
class ResourceExceptionTest
{
static void Main(string[] args)
{
ResourceManager rm = new ResourceManager("Imagenes",
Assembly.GetExecutingAssembly()); Image img = (Image) rm.GetObject("imagen");
img.Save("test.gif", System.Drawing.Imaging.ImageFormat.Gif); Console.WriteLine("The image was successfully saved!");
}
}
}I created a "Imagenes.resources" file using an utility called "Resourcer" from Lutz Roeder which can be downloaded from here: (http://www.aisto.com/roeder/dotnet/). But I don't think that's the problem.
Here is what happens:
- runs on windows with ms.net 1.1
- compiles on linux (mono 1.0) and runs fine (mono's binary) on windows with ms.net 1.1
- on linux running mono 1.0 it explodes with:
Unhandled Exception: System.Runtime.Serialization.SerializationException: The constructor to deserialize an object of type System.Drawing.Bitmap was not found.
in [0x00093] (at /root/monosource/mcs-1.0/class/corlib/System.Runtime.Serialization/ObjectManager.cs:528) System.Runtime.Serialization.ObjectRecord:LoadData (System.Runtime.Serialization.ObjectManager,System.Runtime.Serialization.ISurrogateSelector,System.Runtime.Serialization.StreamingContext)
in [0x00077] (at /root/monosource/mcs-1.0/class/corlib/System.Runtime.Serialization/ObjectManager.cs:82) System.Runtime.Serialization.ObjectManager:DoFixups ()
in [0x00015] (at /root/monosource/mcs-1.0/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:115) System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadNextObject (System.IO.BinaryReader)
in [0x00045] (at /root/monosource/mcs-1.0/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:105) System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObjectGraph (System.IO.BinaryReader,bool,object&,System.Runtime.Remoting.Messaging.Header[]&)
in [0x0007f] (at /root/monosource/mcs-1.0/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:163) System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Deserialize (System.IO.Stream,System.Runtime.Remoting.Messaging.HeaderHandler)
in [0x00003] (at /root/monosource/mcs-1.0/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:127) System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Deserialize (System.IO.Stream)
in [0x002ce] (at /root/monosource/mcs-1.0/class/corlib/System.Resources/ResourceReader.cs:282) System.Resources.ResourceReader:ResourceValue (int)
in [0x0003e] (at /root/monosource/mcs-1.0/class/corlib/System.Resources/ResourceReader.cs:386) ResourceEnumerator:get_Value ()
in [0x00050] (at /root/monosource/mcs-1.0/class/corlib/System.Resources/ResourceSet.cs:201) System.Resources.ResourceSet:ReadResources ()
in [0x00033] (at /root/monosource/mcs-1.0/class/corlib/System.Resources/ResourceSet.cs:157) System.Resources.ResourceSet:GetObject (string,bool)
in [0x00040] (at /root/monosource/mcs-1.0/class/corlib/System.Resources/ResourceManager.cs:180) System.Resources.ResourceManager:GetObject (string,System.Globalization.CultureInfo)
in [0x00003] (at /root/monosource/mcs-1.0/class/corlib/System.Resources/ResourceManager.cs:162) System.Resources.ResourceManager:GetObject (string)
in [0x00016] (at /home/http/rbTestMono/ResourceTests/ResourceTest.cs:20) ResourceTests.ResourceExceptionTest:Main (string[])
Am I doing something wrong? Is Bitmap not supported yet? You can't save to .gif? Should I report a bug?
Mariano.
_______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
