Using TailCallAttribute
on a function that uses use
does not result in expected warning
#17897
Labels
Area-Compiler-Checking
Type checking, attributes and all aspects of logic checking
Bug
Impact-Low
(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Recently I discovered that we got a stack overflow for a function that we had the
TailCallAttribute
on. It seems that the check doesn't work well for functions that usesuse
to dispose resources.Repro steps
Compile the code above.
example1
results in warning as expected.example2
does not result in a warning.A zip-file with this example is attached. Running
dotnet build
only gives a warning for the first function.RecursionExample.zip
Expected behavior
Both functions should result in warnings regarding the
TailCallAttribute
.Actual behavior
Only
example1
results in a warning.Known workarounds
In code reviews manually check that functions marked with
TailCallAttribute
doesn't useuse
.Related information
The text was updated successfully, but these errors were encountered: