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

TriangleDroid test app crashes while trying to get GL context via SDL2 #389

Closed
charm137 opened this issue Dec 31, 2020 · 6 comments
Closed
Assignees
Labels
area-Windowing bug Something isn't working upstream
Milestone

Comments

@charm137
Copy link

charm137 commented Dec 31, 2020

Encountering the following exception while trying to run the TriangleDroid app within Labs either on an emulator (targeting API 28 / Android 9.0) or on a physical device (a Pixel 2 with API 30 / Android 11). I am using the master branch updated to the commit with no changes to the code: 5b4ab6d

$exception {System.InvalidProgramException: Invalid IL code in Silk.NET.SDL.SdlContext:AssertNotCreated (): IL_0008: cgt.un

Stacktrace:

  at Silk.NET.SDL.SdlContext.set_Window (Silk.NET.SDL.Window* value) [0x00001] in E:\Code\Silk.NET\src\Windowing\Silk.NET.SDL\SdlContext.cs:48 
  at Silk.NET.SDL.SdlContext..ctor (Silk.NET.SDL.Sdl sdl, Silk.NET.SDL.Window* window, Silk.NET.Core.Contexts.IGLContextSource source, System.ValueTuple`2[Silk.NET.SDL.GLattr,System.Int32][] attributes) [0x0000f] in E:\Code\Silk.NET\src\Windowing\Silk.NET.SDL\SdlContext.cs:32 
  at Silk.NET.Windowing.Sdl.SdlView.get_GLContext () [0x00000] in E:\Code\Silk.NET\src\Windowing\Silk.NET.Windowing.Sdl\SdlView.cs:58 
  at Silk.NET.Windowing.Sdl.SdlView.CoreInitialize (Silk.NET.Windowing.ViewOptions opts, System.Nullable`1[T] additionalFlags, System.Nullable`1[T] x, System.Nullable`1[T] y, System.Nullable`1[T] w, System.Nullable`1[T] h, System.String title, Silk.NET.Core.Contexts.IGLContext sharedContext) [0x0012b] in E:\Code\Silk.NET\src\Windowing\Silk.NET.Windowing.Sdl\SdlView.cs:161 
  at Silk.NET.Windowing.Sdl.SdlView.CoreInitialize (Silk.NET.Windowing.ViewOptions opts) [0x00000] in E:\Code\Silk.NET\src\Windowing\Silk.NET.Windowing.Sdl\SdlView.cs:100 
  at Silk.NET.Windowing.Internals.ViewImplementationBase.Initialize () [0x00011] in E:\Code\Silk.NET\src\Windowing\Silk.NET.Windowing.Common\Internals\ViewImplementationBase.cs:97 
  at Silk.NET.Windowing.WindowExtensions.Run (Silk.NET.Windowing.IView view) [0x0000e] in E:\Code\Silk.NET\src\Windowing\Silk.NET.Windowing.Common\WindowExtensions.cs:47 
  at Triangle.Program.Main (System.String[] args) [0x000d7] in E:\Code\Silk.NET\src\Lab\Triangle\Program.cs:58 
  at TriangleDroid.MainActivity.OnRun () [0x00016] in E:\Code\Silk.NET\src\Lab\TriangleDroid\MainActivity.cs:20 
  at Silk.NET.Windowing.Sdl.Android.SilkActivity.Run () [0x00001] in E:\Code\Silk.NET\src\Windowing\Android\Silk.NET.Windowing.Sdl.Android\Additions\SilkActivity.cs:65 
  at Silk.NET.Windowing.Sdl.Android.SilkActivity.Main () [0x00019] in E:\Code\Silk.NET\src\Windowing\Android\Silk.NET.Windowing.Sdl.Android\Additions\SilkActivity.cs:45 
  at (wrapper native-to-managed) Silk.NET.Windowing.Sdl.Android.SilkActivity.Main()}	System.InvalidProgramException

Steps to reproduce

  • Platform: Mobile (physical and emulator)
  • Framework Version: .NET Core 3, Xamarin Android 9.0/11.0
  • API: OpenGL
  • API Version: OpenGLES 3.0 (I think)
  1. Try to launch the TriangleDroid via Visual Studio 2019 either on an emulator or an Android device

Normal Xamarin.Android apps work properly so I am not sure if it's a problem with my specific set up. Please let me know if any other info would be of help.

@charm137 charm137 added the bug Something isn't working label Dec 31, 2020
@thargy
Copy link
Contributor

thargy commented Dec 31, 2020

This might be a mono bug? I found this report from 17 June.

@Perksey
Copy link
Member

Perksey commented Dec 31, 2020

Can you try to obtian the version of Mono your Xamarin framework is using? Filing an issue upstream as this looks to be a Mono bug.

@charm137
Copy link
Author

charm137 commented Jan 1, 2021

Thank you for investigating. I am using Xamarin.Android 11.1.0.17 which I believe uses the Mono 6.12 runtime ( mono/mono@be2226b5a1c ).

@Perksey Perksey added this to the 2.0 milestone Jan 1, 2021
@Perksey Perksey self-assigned this Jan 1, 2021
@charm137
Copy link
Author

charm137 commented Jan 2, 2021

Thanks. This simple workaround (in the latest commit) works.

@Perksey
Copy link
Member

Perksey commented Jan 2, 2021

Ah glad to hear it!

@Perksey
Copy link
Member

Perksey commented Jan 2, 2021

Closing as we added a working workaround in 2.0, which is now in full release 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windowing bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

3 participants