Skip to content
Discussion options

You must be logged in to vote

ValueTuples are mutable structs. And so is e.g. System.Drawing.Point. I don't think warning on every copy of those types is reasonable.

Also, how does the compiler figure out whether a struct is immutable? We now have readonly struct, but not every immutable struct is going to be marked as such.

What types other thank SpinLock are problematic? Maybe just a subset of all structs should be prevented from being copied? The issue #859 discusses exactly that and it even links to an analyzer which produces an error when a non-copyable struct is copied.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3252 on November 23, 2020 11:44.