-
Notifications
You must be signed in to change notification settings - Fork 790
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
Fix debugging of code using Anonymous records #6608
Conversation
Wow, interesting! |
I think it is early enough that we can get away with this. But do I understand this correctly that this introduces a binary breaking change for users just by updating the compiler? |
Thanks for bringing it up, it's worth thinking about. @dsyme would be the expert here but my gut feel is no. The stamp in an anonymous record is calculated with a hashing function and we don't guarantee binary compatibility for a given hash function. Here's another take:
|
Just to be clear: In the hashcode example we change behavior. In this particular PR we straight up break it and execution will fail at runtime as we basically renamed the type. Example: #6479 By the way: Looking at the code and the error in #6479, I wouldn't be surprised if this PR fixes that issue as well. |
(I know I'm potentially playing the 😈 here, but if a bunch of issues pop up because people started to depend on this we should at least have some idea how to move forward. Also those issues will probably pop up after some time...) Personally I still think this PR is the right thing to do. But we should be ready to either tell everyone in the ecosystem that ' in the class-name are allowed or that this was a compiler bug breaking the IL spec and there is nothing else to do... |
This is no different than if the underlying hash generated in the name had changed due to changing the hashing function (for some reason), no? |
Yes and no. Yes because if the F# compiler depends on the hashcode this is indeed a unexpected sideeffect of the issue, which isn't mentioned in the issue. If there are such dependencies you should bring them up into the discussion (I haven't seen them but tbh. I focused on @dsyme comments). |
It’s a breaking change. But it’s one that we can live with, the work around is to recompile the library, and then life will be fine. The anonymous types feature first shipped in VS 16.0 which was I think less than 2 months ago.
We will add a release note, describing the issue and the work around.
Thanks
Kevin
|
Yes, it is a binary breaking change. Libraries compiled with a dev16.0 compiler that use public anonymous records and consumed with a dev16.1 compiler will experience a peverify/runtime failure. The library should be recompiled with a dev16.1 compiler. @KevinRansom is correct, we should just make this change. Using anonymous records is rare at this stage, and using them in the API of public-facing libraries (e.g. ones pushed to nuget) even rarer, and consuming those libraries with a later compiler even rarer still. And the adjustment needed to recompile and republish the library is fairly simple. We should in future be much surer to check scenarios such as debugging (and not just rely on the author of the PR to do it....). |
Is there a schedule on when to expect this fix to appear as a VS Update / in the dotnet core sdk ? |
@JaggerJo The 16.1 VS release and associated .NET Core SDK. |
@cartermp I just installed VS 16.1.1 today and rebuilt everything (even manually deleted obj folders) and I'm still experiencing this issue, have I done something wrong? |
Confirmed the full name does not have the
|
This fixes #6512, debugging of code using anonymous records
@cartermp Like #6606 this should go into the fixes ASAP
The problem was with the name of the type for anonymous records in generated .NET code had an extra
'
character that was confusing the debuggers. Just removing the character is the best fix.