opentk / GLControl

WinForms control for OpenTK 4.x.
https://opentk.net
Other
54 stars 24 forks source link

NullReferenceException at the DesignMode checker #1

Closed Zimbo23 closed 3 years ago

Zimbo23 commented 3 years ago

There is a Null Reference Exception at

GLControl.cs, DetermineIfThisIsDesignMode().

In the for-Loop, control.Site is Null.

It happened to me when i was trying to run the given test forms.

seanofw commented 3 years ago

I still can't reproduce this; it runs fine locally for me, both at runtime, and in the new VS2019 designer for .NET Core. (I am using Visual Studio Professional 2019, 16.8.3, with the new designer enabled.)

Note: The old WinForms designer doesn't support .NET Core, so if you want to use .NET Core WinForms in Visual Studio, you'll have to enable the new designer.

seanofw commented 3 years ago

Also, if you could, please try the code in this pull request and see if it resolves the issue:

https://github.com/opentk/GLControl/pull/2

(The revised code itself may be checked out here: https://github.com/seanofw/GLControl )

Zimbo23 commented 3 years ago

The new code worked fine for me, at design time and at runtime.

seanofw commented 3 years ago

Well, I'm glad that the fix works, and I'll merge that in properly now that it does; but I still can't figure out why you were getting the exception in the first place. What version of .NET Core are you using? All of my testing has been in .NET Core 3.1, so maybe if you're using .NET Core 5, that could affect it.

At design time, do you correctly see the spinning cube inside the GLControl?

Zimbo23 commented 3 years ago

I'm using .NET Core 3.1, too.

And I can see the spinning cubes.

seanofw commented 3 years ago

All right, well, it sounds like the fix works in both cases, so I'll take that as confirmation. We'll get the pull request merged into the master branch. Thanks for putting up with the bugs while we polish things up!