Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGlControlBase.EnsureInitializedCore: Object reference not set to an instance of an object #8566

Open
hez2010 opened this issue Jul 21, 2022 · 1 comment
Labels

Comments

@hez2010
Copy link
Contributor

hez2010 commented Jul 21, 2022

Describe the bug

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Avalonia.OpenGL.Controls.OpenGlControlBase.EnsureInitializedCore() in E:\source\repos\Avalonia\src\Avalonia.OpenGL\Controls\OpenGlControlBase.cs:line 151
   at Avalonia.OpenGL.Controls.OpenGlControlBase.EnsureInitialized() in E:\source\repos\Avalonia\src\Avalonia.OpenGL\Controls\OpenGlControlBase.cs:line 215
   at Avalonia.OpenGL.Controls.OpenGlControlBase.Render(DrawingContext ) in E:\source\repos\Avalonia\src\Avalonia.OpenGL\Controls\OpenGlControlBase.cs:line 22
   at Avalonia.Rendering.Composition.CompositingRenderer.Update() in E:\source\repos\Avalonia\src\Avalonia.Base\Rendering\Composition\CompositingRenderer.cs:line 227
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 ) in E:\source\repos\Avalonia\src\Avalonia.Base\Threading\JobRunner.cs:line 38
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr , UInt32 , IntPtr , IntPtr ) in E:\source\repos\Avalonia\src\Windows\Avalonia.Win32\Win32Platform.cs:line 296
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& )
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken ) in E:\source\repos\Avalonia\src\Windows\Avalonia.Win32\Win32Platform.cs:line 223
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken ) in E:\source\repos\Avalonia\src\Avalonia.Base\Threading\Dispatcher.cs:line 61
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] ) in E:\source\repos\Avalonia\src\Avalonia.Controls\ApplicationLifetimes\ClassicDesktopStyleApplicationLifetime.cs:line 120
   at ControlCatalog.NetCore.Program.Main(String[] ) in E:\source\repos\Avalonia\samples\ControlCatalog.NetCore\Program.cs:line 103

To Reproduce
Steps to reproduce the behavior:

  1. Enable UseWgl in CC.NetCore
  2. Build and run
  3. Click the first menu item "Composition"
  4. Press and hold the down arrow key
  5. Crash

Expected behavior
No exception should happen

Analysis
CreateSharedContext can returns null without exceptions.

Desktop (please complete the following information):

  • OS: Windows 11
  • Version: build from master
@hez2010
Copy link
Contributor Author

hez2010 commented Aug 7, 2022

This issue has been mitigated by #8569, now failure to create additional OpenGL context will not result in crashing, instead it yields an empty context and give up further rendering.
We still need to figure out the reason for the failure after several times of OpenGL shared context creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant