Skip to content

Commit

Permalink
clarify source and binary break.
Browse files Browse the repository at this point in the history
  • Loading branch information
BillWagner committed Jul 23, 2024
1 parent bd4cf5e commit 4d00ce6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions docs/csharp/language-reference/builtin-types/ref-struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ These restrictions ensure that a `ref struct` type that implements an interface
The compiler enforces these restrictions. If you write `ref struct` types that implement interfaces, each new update may include new [default interface members](../keywords/interface.md#default-interface-members). Until you provide an implementation for these new methods, your application won't compile.

> [!IMPORTANT]
> A `ref struct` that implements an interface in an external dependency can lead to a runtime exception under the following conditions:
> A `ref struct` that implements an interface includes the potential for later source-breaking and binary-breaking changes. The break occurs if a `ref struct` implements an interface defined in another assembly, and that assembly provides an update which adds default members to that interface.
>
> 1. The interface defined in the external dependency adds a new member with a default implementation.
> 1. The updated dependency is installed without recompiling the application.
> 1. A code path calls the new interface member, which resolves to the default implementation.
> The source-break happens when you recompile the `ref struct`: It must implement the new member, even though there is a default implementation.
>
> All these conditions must be met for that runtime exception to occur.
> The binary-break happens if you upgrade the external assembly without recompiling the `ref struct` type *and* the updated code calls the default implementation of the new method. The runtime throws an exception when the default member is accessed.
## C# language specification

Expand Down

0 comments on commit 4d00ce6

Please sign in to comment.