question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unboxing of Nullable<T> is not implemented

See original GitHub issue

Area of Cosmos - What area of Cosmos are we dealing with?

BCL tests

Expected Behaviour - What do you think that should happen?

The unboxing should succeed and HasValue should be true.

Actual Behaviour - What unexpectedly happens?

We know it is not implemented so this is totally expected but…

09:40:33.367007 Error: Error: Exception: System.Exception: Error compiling method ‘SystemVoidBoxingTestsKernelTestUnboxingNullable’: System.NotImplementedException: The method or operation is not implemented. 09:40:33.405042 Error: at Cosmos.IL2CPU.X86.IL.Unbox.Execute(_MethodInfo aMethod, ILOpCode aOpCode) in C:\Users\fano\Documents\GitHub\Cosmos\IL2CPU\source\Cosmos.IL2CPU\IL\Unbox.cs:line 78 09:40:33.405973 Error: at Cosmos.IL2CPU.X86.IL.Unbox_Any.Execute(_MethodInfo aMethod, ILOpCode aOpCode) in C:\Users\fano\Documents\GitHub\Cosmos\IL2CPU\source\Cosmos.IL2CPU\IL\Unbox_Any.cs:line 22

Reproduction - How did you get this error to appear?

        private void TestUnboxingNullable()
        {
            object x = 42;

            int? y = (int?)x;

            Assert.IsTrue(y.HasValue == true, "Unboxing of Nullable<int> does not work");
        }

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

Last devKit

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PlatinumLyfecommented, Jan 26, 2019

I assume you guys look at CoreRT ? https://github.com/dotnet/corert

Seems there could be a lot of overlap between the two, because they compile for native operation on any OS - which means they’ve probably had to deal with a lot of the issues you have on converting C# to CPU commands/assembler.

0reactions
github-actions[bot]commented, May 1, 2021

As this issue has received no new activity, it has been marked as stale

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Boxing / Unboxing Nullable Types - Why this ...
The problem is that a boxed value type cannot be simply unboxed into a nullable version of that value type because the boxed...
Read more >
Possible codegen issue with unbox instruction for nullable ...
I encountered a bug when using the "unbox valuetype System.Nullable`1<!!0>" instruction. The bug causes the unboxed value to be incorrect.
Read more >
Nullable value types - C# reference
Boxing and unboxing​​ An instance of a nullable value type T? is boxed as follows: If HasValue returns false , the null reference...
Read more >
Resolve nullable warnings
Several compiler warnings indicate code that isn't null-safe. Learn how to address those warnings by making your code more resilient.
Read more >
For the last time, you can't unbox a value type as a diff
Nullable value types get boxed as their non-nullable counterparts, which means there is no way to "unbox" a nullable value; or in other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found