Skip to content

Assert.Throws ambiguity between Func<object>, string and Action, AssertNonStrictThrowsInterpolatedStringHandler overloads #5618

@Youssef1313

Description

@Youssef1313

Describe the bug

error CS0121: The call is ambiguous between the following methods or properties: 'Assert.Throws(Func<object?>, string, params object[])' and 'Assert.Throws(Action, ref Assert.AssertNonStrictThrowsInterpolatedStringHandler)'

NOTE: This is a regression.

Steps To Reproduce

Assert.Throws<Exception>(() => Console.ReadLine(), $"Hello {0}");

Expected behavior

It should compile

Actual behavior

Ambiguous

Additional context

Adding an extra overload for interpolated string for Func<object?> resolves this.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions