Avalonia
Avalonia copied to clipboard
OpenGlControlBase.EnsureInitializedCore: Object reference not set to an instance of an object
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:
- Enable
UseWglin CC.NetCore - Build and run
- Click the first menu item "Composition"
- Press and hold the down arrow key
- 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
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.