You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft Visual Studio Professional 2019 Preview
Version 16.10.0 Preview 1.0
VisualStudio.16.Preview/16.10.0-pre.1.0+31025.218
Microsoft .NET Framework
Version 4.8.04084
I think an analogous bug exists for list patterns when an indexer lacks an override of a get accessor. I will add it to #51289.
I think this test should be added, although I could be wrong about the details, and of course a baseline needs to be included:
[Fact,WorkItem(51801,"https://github.com/dotnet/roslyn/issues/51801")]publicvoidIndexerOverrideLacksAccessor(){varsource=@"#nullable enableclass Base{ public virtual object this[int i] { get { return 1; } set { } }}class C : Base{ public override object this[int i] { set { } } public int Length => 1; public string Value { get; } public string M() { switch (this) { case [1]: return Value; default: return Value; } }}";varverifier=CompileAndVerify(source);verifier.VerifyIL("C.M",@"");
Version Used:
Steps to Reproduce:
Compile the following code
Expected Behavior:
Either the code compiles or there's a compilation error somewhere in the code (probably on the
case { IsOk: true }:
)Actual Behavior:
Error MSB6006: "csc.exe" exited with code -2146232797. (1, 1)
Notes
This example on sharplab.io gives the following exception:
The text was updated successfully, but these errors were encountered: