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.

TypeLoadException when pointer is used as member of Records

See original GitHub issue

Version Used: master(sharplab)

Steps to Reproduce: public unsafe record Test1(int* x);

https://sharplab.io/#v2:EYLgtghgzgLgpgJwDQxNMSAmIDUAfAAQCYBGAWAChKA7CMOKABwgGM4ACAkgOgCUBXajACW9bgGEA9mEbCANogDKiAG7C2UAN7F2ASSgBRAB7wEtOburCYmgL63KBAMztBUCADMOCOC0kJMdgAVBhgSAAphIQAqdiMASgBuIA===

Expected Behavior: It’s just an test, not sure what’s the expected behavior. Maybe report compile error, or emit an valid IL.

Actual Behavior: System.TypeLoadException: The generic type ‘System.Collections.Generic.EqualityComparer`1’ was used with an invalid instantiation in assembly ‘System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e’.

Seems EqualityComparer<int*>.Default is not vaild.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jaredparcommented, Oct 23, 2020

True. I should have said “record members”

0reactions
jcouvcommented, Oct 26, 2020

From LDM 10/26/2020, we’re going to block this scenario for now. I’ll open a follow-up proposal in csharplang. We’ll disallow all “restricted types” (which cannot be used as type arguments).

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - TypeLoadException says 'no implementation', but it is ...
I got this when my application didn't have a reference to another assembly defining a class that the method in the error message...
Read more >
Pointer related operators - access memory and ...
Learn about C# operators that you can use when working with pointers. You use these operators to access memory, index memory locations and ......
Read more >
TypeLoadException struct problems - C# / C Sharp
Hello, When I use the following structure at the Load event I get a type load exception. [StructLayout(LayoutKind.Explicit)]
Read more >
Pointers to members (C++ only)
Pointers to members allow you to refer to nonstatic members of class objects. You cannot use a pointer to member to point to...
Read more >
Pointers to Member Functions, C++ FAQ
How do I create and use an array of pointer-to-member-function? ... The this pointer points to the instance data for the object.
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