[Mono-winforms-list] Runtime error accessing Icons in Resources

Carlos Alberto Cortez calberto.cortez at gmail.com
Tue Jan 26 15:12:51 EST 2010


This seems to be a resources issue. Would it be possible to get the code
producing this error, so we could test what's happening?

Carlos.

2010/1/18 georgec <giorgos.constantinou at gmail.com>

>
> The following code is running fine on .NET but produces a runtime error
> with
> Mono:
>
>        1:   relationsTreeView.ImageList = new ImageList();
>        2:   relationsTreeView.ImageList.Images.Add(Resources.nodeIcon);
>
> This error exists in all the cases that I reference images and icons from
> the Resources as specified in VS 2008.
> Is there something that I am missing?
> (also MoMA did not find any problems with my code compatibility on mono)
>
> The following error is reported:
>
> Unhandled Exception: System.Reflection.TargetInvocationException: Exception
> has
> been thrown by the target of an invocation. --->
> System.ComponentModel.Win32Exce
> ption: No valid icon entry were found.
>  at System.Drawing.Icon.InitFromStreamWithSize (System.IO.Stream stream,
> Int32
> width, Int32 height) [0x0056e] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2
> .3\mcs\class\System.Drawing\System.Drawing\Icon.cs:807
>  at System.Drawing.Icon..ctor
> (System.Runtime.Serialization.SerializationInfo i
> nfo, StreamingContext context) [0x000b2] in
> C:\cygwin\tmp\monobuild\build\BUILD\
> mono-2.4.2.3\mcs\class\System.Drawing\System.Drawing\Icon.cs:229
>  at (wrapper managed-to-native)
> System.Reflection.MonoCMethod:InternalInvoke (o
> bject,object[],System.Exception&)
>  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
> invok
> eAttr, System.Reflection.Binder binder, System.Object[] parameters,
> System.Globa
> lization.CultureInfo culture) [0x000a6] in
> C:\cygwin\tmp\monobuild\build\BUILD\m
> ono-2.4.2.3\mcs\class\corlib\System.Reflection\MonoMethod.cs:444
>  --- End of inner exception stack trace ---
>  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
> invok
> eAttr, System.Reflection.Binder binder, System.Object[] parameters,
> System.Globa
> lization.CultureInfo culture) [0x000b8] in
> C:\cygwin\tmp\monobuild\build\BUILD\m
> ono-2.4.2.3\mcs\class\corlib\System.Reflection\MonoMethod.cs:450
>  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[]
> par
> ameters) [0x00000] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class
> \corlib\System.Reflection\MethodBase.cs:111
>  at System.Runtime.Serialization.ObjectRecord.LoadData
> (System.Runtime.Serializ
> ation.ObjectManager manager, ISurrogateSelector selector, StreamingContext
> conte
> xt) [0x000d7] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corl
> ib\System.Runtime.Serialization\ObjectManager.cs:578
>  at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00066] in
> C:\cygw
>
> in\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Runtime.Serial
> ization\ObjectManager.cs:84
>  at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject
> (System.IO.BinaryReader reader) [0x0000f] in
> C:\cygwin\tmp\monobuild\build\BUILD
>
> \mono-2.4.2.3\mcs\class\corlib\System.Runtime.Serialization.Formatters.Binary\Ob
> jectReader.cs:115
>  at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph
>  (System.IO.BinaryReader reader, Boolean readHeaders, System.Object&
> result,
> Sys
> tem.Runtime.Remoting.Messaging.Header[]& headers) [0x00041] in
> C:\cygwin\tmp\mon
> obuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\
> System.Runtime.Serialization.Fo
> rmatters.Binary\ObjectReader.cs:99
>  at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeser
> ialize (System.IO.Stream serializationStream,
> System.Runtime.Remoting.Messaging.
> HeaderHandler handler) [0x00076] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4
>
> .2.3\mcs\class\corlib\System.Runtime.Serialization.Formatters.Binary\BinaryForma
> tter.cs:177
>  at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
> (System.IO.Stream serializationStream) [0x00000] in
> C:\cygwin\tmp\monobuild\buil
> d\BUILD\mono-2.4.2.3\mcs\class\corlib\
> System.Runtime.Serialization.Formatters.Bi
> nary\BinaryFormatter.cs:134
>  at System.Resources.ResourceReader.ReadNonPredefinedValue (System.Type
> exp_typ
> e) [0x00000] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corli
> b\System.Resources\ResourceReader.cs:397
>  at System.Resources.ResourceReader.ReadValueVer2 (Int32 type_index)
> [0x001f3]
> in
>
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Reso
> urces\ResourceReader.cs:355
>  at System.Resources.ResourceReader.LoadResourceValues
> (.ResourceCacheItem[] st
> ore) [0x00076] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\cor
> lib\System.Resources\ResourceReader.cs:433
>  at System.Resources.ResourceReader+ResourceEnumerator.FillCache ()
> [0x00049] i
> n
>
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Resou
> rces\ResourceReader.cs:686
>  at System.Resources.ResourceReader+ResourceEnumerator..ctor
> (System.Resources.
> ResourceReader readerToEnumerate) [0x00014] in
> C:\cygwin\tmp\monobuild\build\BUI
> LD\mono-2.4.2.3\mcs\class\corlib\System.Resources\ResourceReader.cs:588
>  at System.Resources.ResourceReader.GetEnumerator () [0x00016] in
> C:\cygwin\tmp
>
> \monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Resources\ResourceRe
> ader.cs:501
>  at System.Resources.ResourceSet.ReadResources () [0x0003f] in
> C:\cygwin\tmp\mo
>
> nobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Resources\ResourceSet.c
> s:228
>  at System.Resources.ResourceSet.GetObjectInternal (System.String name,
> Boolean
>  ignoreCase) [0x00027] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\c
> lass\corlib\System.Resources\ResourceSet.cs:161
>  at System.Resources.ResourceSet.GetObject (System.String name, Boolean
> ignoreC
> ase) [0x00000] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\cor
> lib\System.Resources\ResourceSet.cs:185
>  at System.Resources.RuntimeResourceSet.GetObject (System.String name,
> Boolean
> ignoreCase) [0x00016] in
> C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\cl
> ass\corlib\System.Resources\RuntimeResourceSet.cs:74
>  at System.Resources.ResourceManager.GetObject (System.String name,
> System.Glob
> alization.CultureInfo culture) [0x00038] in
> C:\cygwin\tmp\monobuild\build\BUILD\
> mono-2.4.2.3\mcs\class\corlib\System.Resources\ResourceManager.cs:212
>  at QV.Visualiser.Properties.Resources.get_objects_067 () [0x00001] in
> C:\QV\Vi
> sualiser\Properties\Resources.Designer.cs:597
>  at QV.Visualiser.Viewer.ViewContainer.initTabControl () [0x0004e] in
> C:\QV\Vis
> ualiser\Viewer\ViewContainer.cs:54
>  at QV.Visualiser.Viewer.ViewContainer..ctor () [0x0001d] in
> C:\QV\Visualiser\V
> iewer\ViewContainer.cs:23
>  at (wrapper remoting-invoke-with-check)
> QV.Visualiser.Viewer.ViewContainer:.ct
> or ()
>  at QV.Visualiser.Visualiser.InitializeComponent () [0x0015b] in
> C:\QV\Visualis
> er\Visualiser.Designer.cs:62
>  at QV.Visualiser.Visualiser..ctor () [0x00016] in
> C:\QV\Visualiser\Visualiser.
> cs:24
>  at (wrapper remoting-invoke-with-check) QV.Visualiser.Visualiser:.ctor ()
>  at QV.Visualiser.Program.Main () [0x0000e] in
> C:\QV\Visualiser\Program.cs:19
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/Runtime-error-accessing-Icons-in-Resources-tp27216187p27216187.html
> Sent from the Mono - WinForms mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20100126/5954ec3d/attachment-0001.html 


More information about the Mono-winforms-list mailing list