Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug.Assert failures often leave CI state timing out without additional info on .NET Framework #4577

Open
Youssef1313 opened this issue Jan 9, 2025 · 4 comments

Comments

@Youssef1313
Copy link
Member

I'm thinking of banning Debug.Assert, and instead introduce CIDebug.Assert

When building in CI, we can build with some MSBuild property that propagates back to DefineConstants, and DebugOrCI.Assert could be something like this:

internal static class CIDebug
{
#if IS_CI && NETFRAMEWORK
    [Conditional("DEBUG")]
    public static void Assert(...) { if (...) throw ...; }
#else
    [Conditional("DEBUG")]
    public static void Assert(...) => Debug.Assert(...);
#endif
}

@Evangelink thoughts?

@Evangelink
Copy link
Member

I think it's already banned to favor using RoslynDebug class to have compiler hinting.

Otherwise LGTM

@Youssef1313
Copy link
Member Author

RoslynDebug appears to be only in Analyzers and Platform

@nohwnd
Copy link
Member

nohwnd commented Jan 9, 2025

are you talking about usage in our code, or general usage like this issue: #3955 ?

@Youssef1313
Copy link
Member Author

@nohwnd Only usages in our code. This is only to make our life easier when an assert fails in CI. So, basically when running in CI and in Debug, we swap Debug.Assert with throw some exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants