SteveDunn / Vogen

A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Apache License 2.0
877 stars 45 forks source link

Incorrect behavior of DebuggerDisplay in Rider #484

Closed YuriiNskyi closed 1 year ago

YuriiNskyi commented 1 year ago

Describe the bug

Using Rider 2022.3.2, .NET 7, and latest version of Vogen.

Steps to reproduce

Use the following simple VO:

[ValueObject<string>]
public readonly partial struct StringValue
{
    private static Validation Validate(
        string input)
        => ValueObjectValidation.NotNutllOrWhiteSpace(input);
}

Check the expression var q = StringValue.From("dfsdf"); inside debugger.

You will see:

Underlying type: System.String, Value = Failed to read field: Value does not fall within the expected range. The error code is E_INVALIDARG, or COR_E_ARGUMENT, or WIN32_ERROR_INVALID_PARAMETER, or 0x80070057.

Expected behaviour

Working DebuggerDisplay. In fact, inside Visual Studio this functionality works as expected.

SteveDunn commented 1 year ago

Thanks for the bug report @YuriiNskyi . Unfortunately, Rider doesn't support as many debug features as Visual Studio does.

Some of these limitations I mentioned in a blog post a while ago.

There is however, a parameter that you can apply to either local ValueObject attributes or the global VogenDefaults attributes, named debuggerAttributes. Setting this to Basic (#)stops the errors in the Rider IDE. Hopefully they'll fix them at some point.

I'll close this bug as there's nothing that can be done in Vogen to fix this, however, if you feel there is a workaround, or if I've just got the wrong end of the stick, then please let me know.

Thanks again.