Lazzu's picture

Program crashes with latest opentk

We've built opentk from https://github.com/thefiddler/opentk

It works quite well on linux, but on windows 8.1 it crashes:

Parent '((OpenTK.Platform.Windows.WinRawInput)this).Parent' threw an exception of type 'System.NullReferenceException' OpenTK.Platform.Windows.WinWindowInfo {System.NullReferenceException}
 +  WndProc {Method = {IntPtr WindowProcedure(IntPtr, OpenTK.Platform.Windows.WindowMessage, IntPtr, IntPtr)}} OpenTK.Platform.Windows.WindowProcedure
StackTrace "   at OpenTK.Platform.Windows.WinInputBase.ConstructMessageWindow()\r\n
   at OpenTK.Platform.Windows.WinInputBase.ProcessEvents()\r\n
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n
   at System.Threading.ThreadHelper.ThreadStart()" string
 
  Message "The type initializer for 'OpenTK.Platform.Windows.Constants' threw an exception." string
 
-  _innerException {"Arithmetic operation resulted in an overflow."} System.Exception {System.OverflowException}
StackTrace "   at System.IntPtr..ctor(Int64 value)\r\n
   at OpenTK.Platform.Windows.Constants..cctor()" string

We have tried with dll built with mono and visual studio, both give same result. Also, if we use the old 1.1 dll file it runs fine.

Should I btw post possible future issues on this site or github?


Comments

Comment viewing options

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

We used now debug build from visual studio, and got more info on the stack trace:

StackTrace "   at OpenTK.Platform.Windows.WinInputBase.ConstructMessageWindow() in opentk\\Source\\OpenTK\\Platform\\Windows\\WinInputBase.cs:line 82\r\n
   at OpenTK.Platform.Windows.WinInputBase.ProcessEvents() in opentk\\Source\\OpenTK\\Platform\\Windows\\WinInputBase.cs:line 96\r\n
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n
   at System.Threading.ThreadHelper.ThreadStart()" string
the Fiddler's picture

This has been fixed in master: https://github.com/thefiddler/opentk

You can expect a new release shortly (but I would also encourage you to update and test directly from git.)

Lazzu's picture

Has it now? Last commit appears to be from you 9 days ago, and we pulled it fresh yesterday.

the Fiddler's picture

Weird, give me a moment to check.

the Fiddler's picture

Ok, this was a different issue than the one I was thinking. It is caused by an overflow in an uint->int->IntPtr conversion that only affects 32-bit machines.

Fixed now.

Edit: it would be better to report bugs on github, if only because it is simpler to cross-reference commits with specific bug numbers, but reporting here also works.

Lazzu's picture

Thanks! Will report on github from now on. I prefer it myself too, but I wondered what you were thinking about it as there's this website too. Also I'd have mentioned that the windows machine was 32bit, but the other guy didn't mention that, so I didn't know. I presumed it was 64bit as every windows box should be nowdays. :)

EDIT: He claims it's 64bit. Now how does this issue come up? I don't understand as I am not really that experienced with diffirences with 32bit and 64bit software.

the Fiddler's picture

Are you compiling your project for AnyCPU or for x86? I think recent Visual Studio versions force x86 by default.

Lazzu's picture

AnyCPU with both visual studio 2012 and mono xbuild, both produced the error.

the Fiddler's picture

I cannot seem to reproduce this after the latest commit, can you please verify whether it is working now?

Lazzu's picture

Yes, it seems to work. Thanks.