I make winforms application on vb.net. When I try to run it under mono (without wine, with mono-vbnc installed) in Linux Mint 18, I get an error

Unhandled Exception: System.InvalidOperationException: WinForms_SeeInnerException ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: No valid icon entry were found. at System.Drawing.Icon.InitFromStreamWithSize (System.IO.Stream stream, Int32 width, Int32 height) <0x4046cc50 + 0x00f9b> in <filename unknown>:0 at System.Drawing.Icon..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext context) <0x4051fa00 + 0x001db> in <filename unknown>:0 

Removed the icon from the application and the form, and also deleted the icon from the resources - the error disappeared.

Is it possible to run an application / form with an icon under mono?
And what requirements are imposed on it?

Can I make different resource files for different build configurations?

I compile in VS2015.

  • It seems to be working on the basis of this bug: bugzilla.xamarin.com/show_bug.cgi?id=30715 - VladD pm
  • @VladD, what exactly should work? It worked for me only after removing the icon from the resource file. While it was there, the program did not start, even though the icon was not used anywhere (I first removed the application icons and forms, but it remained in Form1.resx). - Qwertiy
  • Icons for Mono :) Here another bug reporter seems to say that the icon 256x256 does not roll, will you try to remove only it? - VladD
  • @VladD, it was the only one and just the same 256 * 256. And oops .. In Windows, it also does not open everything. Universal Viewer said "Out of system resources." o_O Although the conductor shows correctly. - Qwertiy
  • one
    Apparently, this is a bug. Because the idea should work. - VladD

1 answer 1

An investigation into the comments showed that the problem is with the icon 256 × 256. Apparently, this code is guilty, which deliberately ignores the large size.

Thus, if there is a single icon of size 256 × 256, it is not located, and the application crashes with an exception .

It makes sense to add smaller icons, and not to delete this icon, so the same application can find a large icon under other systems.

  • @Qwertiy: Suddenly I found a guilty code, yes. - VladD
  • Yeah, unexpectedly) Maybe they write somewhere? Or are they in the know? - Qwertiy
  • @Qwertiy: It seems that this bug is on the subject. But they say in the code about backward compatibility, so maybe it makes sense to open an issue on the github. Especially if on fresh Windows 256 × 256 works. Compatibility with bugs of old versions of Windows is not needed! - VladD