Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2017-05-27 10:28:12 +0300
committerGitHub <noreply@github.com>2017-05-27 10:28:12 +0300
commitf04a086bf3911e1db1bbbcee060a9b3986c8d14c (patch)
tree22ae4c92d884a30c7c80b25d31a71cc2cbc165d3 /Documentation
parent86f08b4298b651bdf22dc427d8d4231a43a7ada1 (diff)
Turn "adding virtual to a member" into a breaking change
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/coding-guidelines/breaking-change-rules.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/Documentation/coding-guidelines/breaking-change-rules.md b/Documentation/coding-guidelines/breaking-change-rules.md
index 8481aabb61..5d7409c3b9 100644
--- a/Documentation/coding-guidelines/breaking-change-rules.md
+++ b/Documentation/coding-guidelines/breaking-change-rules.md
@@ -155,9 +155,6 @@ Breaking Change Rules
* Changing a member from `abstract` to `virtual`
-* Adding `virtual` to a member
-> Make note, that marking a member virtual might cause previous consumers to still call the member non-virtually.
-
* Introducing or removing an override
> Make note, that introducing an override might cause previous consumers to skip over the override when calling `base`.
@@ -180,6 +177,9 @@ successfully bind to that overload, if simply passing an `int` value. However, i
* Removing the `virtual` keyword from a member
+* Adding `virtual` to a member
+> While this change would often work without breaking too many scenarios because C# compiler tends to emit `callvirt` IL instructions to call non-virtual methods (`callvirt` performs a null check, while a normal `call` won't), we can't rely on it. C# is not the only language we target and the C# compiler increasingly tries to optimize `callvirt` to a normal `call` whenever the target method is non-virtual and the `this` is provably not null (such as a method accessed through the `?.` null propagation operator). Making a method virtual would mean that consumer code would often end up calling it non-virtually.
+
* Adding or removing `static` keyword from a member
### Signatures