Skip to content

Commit 5ae9ee7

Browse files
Emphasize the call won't throw if constructor completes successfully
Co-authored-by: Bill Wagner <[email protected]>
1 parent 100a8f0 commit 5ae9ee7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/csharp/nullable-references.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ public void Main()
421421
}
422422
```
423423

424-
In the preceding example, the <xref:System.NullReferenceException?displayProperty=nameWithType> will be thrown when `_bar.Dispose();` is executed.
424+
In the preceding example, the <xref:System.NullReferenceException?displayProperty=nameWithType> will be thrown when `_bar.Dispose();` runs, if the `name` parameter was `null`. The call to `_bar.Dispose();` won't ever throw when the constructor completes successfully.
425425

426426
However, there's no warning issued by the compiler, because static analysis can't determine if a method (like a constructor) completes without a runtime exception being thrown.
427427

0 commit comments

Comments
 (0)