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

cgt.un is invalid for comparing a void* with a null type #20710

Closed
Perksey opened this issue Dec 31, 2020 · 1 comment
Closed

cgt.un is invalid for comparing a void* with a null type #20710

Perksey opened this issue Dec 31, 2020 · 1 comment

Comments

@Perksey
Copy link

Perksey commented Dec 31, 2020

Steps to Reproduce

  1. Create a method with an is not null comparison on a void* and compile with Debug configuration using the latest Roslyn.
  2. Attempt to use this in a Mono-powered application
  3. Observe an InvalidProgramException

The generated IL for AssertNotCreated:

nop
ldarg.0      // this
ldfld        void* Silk.NET.SDL.SdlContext::_ctx
ldnull
cgt.un
stloc.0      // V_0
ldloc.0      // V_0
brfalse.s    IL_001a
nop
ldstr        "Context created already."
newobj       instance void [netstandard]System.InvalidOperationException::.ctor(string)
throw
ret

Current Behavior

System.InvalidProgramException: Invalid IL code in Silk.NET.SDL.SdlContext:AssertNotCreated (): IL_0008: cgt.un
  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()

Expected Behavior

The IL is valid and Mono is able to run the application.

On which platforms did you notice this

[ ] macOS
[x] Linux
[ ] Windows

Version Used:

Awaiting response from downstream user.

@Perksey
Copy link
Author

Perksey commented Dec 31, 2020

Apparently one of our community contributors has already filed this.

Duplicate of #20709.

Closing this one.

@Perksey Perksey closed this as completed Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant