shorowit's picture

Crash for some users: bitsPerPixel must be greater than zero

Hi,

I've had a couple users that can consistently hit the following OpenTK crash:

Source:
OpenTK
 
TargetSite:
Void .ctor(Int32, Int32, Int32, Int32, Int32, Single)
 
Message:
Must be greater than zero.
Parameter name: bitsPerPixel
 
Stack Trace:
at OpenTK.DisplayResolution..ctor(Int32 x, Int32 y, Int32 width, Int32 height, Int32 bitsPerPixel, Single refreshRate)
at OpenTK.Platform.Windows.WinDisplayDeviceDriver..cctor()

When I look in their Windows 7 Monitor settings, it shows "True Color (32 bit)", just as it does for me (and it works correctly for me), so I'm not sure why OpenTK is not able to read it correctly.

I'm currently using the latest nightly building from this website. I tried grabbing the master code from the github website but have been unable to compile it successfully using Visual Studio 2012, so I haven't been able to test whether the bug is still there.

(When I try compiling the git source code, it complains that "Source file '..\GlobalAssemblyInfo.cs' could not be found.")

Thanks for any light that you can shed.

Scott


Comments

Comment viewing options

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

Well, I figured out how to compile the source code. I'll report back whether the git fork fixes this issue or not.

(If anyone else hits this same issue, you just have to right-click on the OpenTK project in Visual Studio, choose Properties, and then click the Assembly Information button. Just click OK on the window that pops up and it will generate that missing file.)

Scott

the Fiddler's picture

The GlobalAssemblyInfo.cs is a known issue, you just need to right click and build "Build.UpdateVersion" manually before building the whole solution. This will be fixed before the next release.

Please post if the issue is still reproducible with git master. Are you using a single monitor or multiple monitors?

shorowit's picture

OK, the issue is still reproducible with git master. The user has a single monitor setup (laptop attached to a single monitor). I believe he also hits the error when trying to run the application on his laptop without being connected to the monitor.

How can we best diagnose the problem? I'm happy to try whatever helps.

Thanks!

the Fiddler's picture

Alright, the best way would be to capture a debug log and attach it to a bug report in github.

To capture a debug log, you will need to use a debug version of OpenTK.dll with an attached TraceListener. For example:

public static void Main()
{
    using (TextWriterTraceListener dbg = new TextWriterTraceListener("debug.log"))
    {
        Trace.Listeners.Add(dbg);
        ...
        // your code here
        ...
        dbg.Flush();
        dbg.Close();
    }
}

This will create a debug.log file with useful debugging information.

shorowit's picture

Conversation continued here: https://github.com/thefiddler/opentk/issues/6