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
The scenario as layed out in AnonymousTypeRenaming is not yet supported by Renamer.RenameAsync. We could do it ourselves manually but that would probably be rather expensive. It is a niche scenario though so it's not too horrible to leave unsupported for now.
I'm making this issue to keep track of it but it's not something I consider a must-fix until Roslyn supports it themselves.
For reference, the full test:
publicvoidTryCastWithoutUsingAsNotNull_AnonymousTypeRenaming(){varoriginal=@"using System;using System.Text;namespace ConsoleApplication1{ class MyClass { void Method() { object o = 5; if (o is int) { var x = (int) o; var y = new { x }; var z = y.x; } } }}";varexpected=@"using System;using System.Text;namespace ConsoleApplication1{ class MyClass { void Method() { object o = 5; var oAsInt32 = o as int?; if (oAsInt32 != null) { var y = new { oAsInt32 }; var z = y.oAsInt32; } } }}";
VerifyDiagnostic(original,string.Format(TryCastWithoutUsingAsNotNullAnalyzer.Rule.MessageFormat.ToString(),"o"));
VerifyFix(original, expected);}
This currently fails on the line var z = y.oAsInt32; which, in reality, is var z = y.x;
There is one scenario in which TryCastWithoutUsingAsNotNull breaks:
The scenario as layed out in
AnonymousTypeRenaming
is not yet supported byRenamer.RenameAsync
. We could do it ourselves manually but that would probably be rather expensive. It is a niche scenario though so it's not too horrible to leave unsupported for now.I'm making this issue to keep track of it but it's not something I consider a must-fix until Roslyn supports it themselves.
For reference, the full test:
This currently fails on the line
var z = y.oAsInt32;
which, in reality, isvar z = y.x;
Related PR: dotnet/roslyn#5786
The text was updated successfully, but these errors were encountered: