Skip to content

Add interpolated string handler overloads for Assert methods #4273

@Youssef1313

Description

@Youssef1313

Summary

It's common to have Assert.SomeMethod(arguments, message: $"... {something} ... etc");.
The message is only needed when the assert actually fails, which hopefully isn't the common case when running tests :)
Currently, we are paying the cost to construct the string while it ends up not being used. That is exactly what interpolated string handlers tries to solve.

Background and Motivation

Introducing new interpolated string handlers overloads will solve the performance costs for this scenario.

See https://learn.microsoft.com/dotnet/csharp/advanced-topics/performance/interpolated-string-handler for info.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions