I wrote myself an F# OpenGL wrapper with OpenTK and I saw that when I run my application for around 5min it will abort, throw an exception and print it to the console.

The problem is that the console in visual studio immediately closes and I am unable to see the message output.

So I thought I could try to catch it and add a breakpoint like this.

let game = new HelloCube.Game()

try
    game.Run(60.,60.)
with
    | :? System.Exception as e ->
         printfn "%s" e.Message
         printfn "end" //breakpoint

But it doesn't catch the exception.

So I looked at the error code

The program '[4236] HelloCube.exe: Managed (v4.0.30319)' has exited with code 9008 (0x2330).

which I found to be

DNS RR set that ought to exist, does not exist.

This can't be the right error code. An DNS error?

Any ideas what I could try?

有帮助吗?

解决方案

Add ( Console.ReadKey true ) |> ignore to the end of your function. This will cause the console window to pause and wait for a keypress (any keypress) before exiting (see MSDN).

Also, use e.ToString() rather than just e.Message. Exception.ToString() will give you the complete strack trace and other related information which is usually much more helpful then just the Exception Message.

Exit codes are unique to every application. When looking up error codes, you must make sure that the dictionary you are looking at matches the application and version number.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top