AndyKorth's picture

Examples.Program.Main doesn't quite work on a Mac

Project:The Open Toolkit library
Version:1.1.0-2013-11-22
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I noticed some problems while trying out the Example Browser that comes with OpenTK.

While it initially launches fine:
http://i.imgur.com/R5QzD.png

After running a demo then closing that demo, the application hangs for a bit, then Mono crashes hard.

It seems to suggest this is the cause of the crash:

  at (wrapper managed-to-native) System.Windows.Forms.XplatUICarbon.ReceiveNextEvent (uint,intptr,double,bool,intptr&) <IL 0x00034, 0xffffffff>
  at System.Windows.Forms.XplatUICarbon.GetMessage (object,System.Windows.Forms.MSG&,intptr,int,int) [0x000ab] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs:1372
  at System.Windows.Forms.XplatUI.GetMessage (object,System.Windows.Forms.MSG&,intptr,int,int) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:710
  at System.Windows.Forms.Application.RunLoop (bool,System.Windows.Forms.ApplicationContext) [0x003de] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:852
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext) [0x00014] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:724
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:707
  at Examples.Program.Main () [0x00063] in /Users/kortham/projects/opentk/Source/Examples/Main.cs:63
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <IL 0x0004c, 0xffffffff>

Unfortunately, this has sort of reached the level of my debugging skills. It appears this is happening inside code I don't have, the Windows.Forms application stuff.

My system information:
OS X 10.8.2
Graphics NVIDIA GeForce 9400M 256 MB
(and on my second mac, which is a Radeon 5870 HD)

Mono JIT compiler version 2.10.9 (tarball Mon May 7 20:25:51 EDT 2012)
Architecture: x86
LLVM: yes(2.9svn-mono)

OpenTK version: 3125 out of SVN (latest as of this writing)

The full crash report is here:
https://gist.github.com/7e6e5b25c1a742b326da

It's rather lengthy since it includes the stacktrace of the native code where it died, etc.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
AndyKorth's picture

#1

Additionally there seems to be some issues inside OpenTK.Examples.Properties.Resources.get_App().

               object obj = ResourceManager.GetObject("App", resourceCulture);

This one seems to only occur on my 10.8.2 machine, and not my 10.7 machine. I'll need to look into it a bit more, but this should serve as a reminder to me.

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Stream is not a valid .resources file!  It was possibly truncated. ---> System.IO.EndOfStreamException: Failed to read past end of stream.
  at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x00000] in <filename unknown>:0 
  at System.IO.BinaryReader.ReadInt32 () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.ReadHeaders () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Resources.ResourceReader.ReadHeaders () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader..ctor (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceSet..ctor (System.IO.UnmanagedMemoryStream stream) [0x00000] in <filename unknown>:0 
  at System.Resources.RuntimeResourceSet..ctor (System.IO.UnmanagedMemoryStream stream) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.GetObject (System.String name, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at OpenTK.Examples.Properties.Resources.get_App () [0x00000] in /Users/kortham/projects/opentk/Source/Examples/Properties/Resources.Designer.cs:65 
  at Examples.ExampleBrowser..ctor () [0x0004b] in /Users/kortham/projects/opentk/Source/Examples/ExampleBrowser.cs:61 
  at (wrapper remoting-invoke-with-check) Examples.ExampleBrowser:.ctor ()
  at Examples.Program.Main () [0x0000b] in /Users/kortham/projects/opentk/Source/Examples/Main.cs:48

I'm honestly not quite sure what the System.Drawing.Icon App resource might represent on my system. I know some linux windowing toolkits put a little widget in the corner of each window representing an application icon. *shrugs*

Also note that the Examples require X11 on a Mac. In 10.8 and later, the OS will not automatically download X11 if you attempt to use it. This is because Apple no longer maintains it, it's now in the hands of XQuartz.

the Fiddler's picture

#2

Status:open» confirmed

The example browser depends on Windows.Forms which are not really available outside windows. It will be replaced by separate projects in a future release.

the Fiddler's picture

#3

Version:1.x-dev» 1.1.0-2013-11-22
Status:confirmed» closed

In the meantime, this is "fixed" by running the examples in a separate process.