Open
Description
Library Version Info
Confirmed repro on latest on nuget.org repository:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PackageReference Include="ReflectionAnalyzers" Version="0.1.20-dev">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</Project>
Bad
dynamic expando = new ExpandoObject();
expando.name = "John"; // fine
Console.WriteLine(expando["name"] // BAD - expando explicitly implements the IDictionary<TKey, TValue> interface
Correct
((IDictionary<String, Object>)expando)["name"]
I believe this is a bug in REFL018. I believe the issue is due to the dynamic keyword silencing errors, but that is just a hunch - I have done zero debugging so far.
Metadata
Metadata
Assignees
Labels
No labels