Skip to content

Remove ParameterInfo.HasDefaultValue workaround #65233

@deeprobin

Description

@deeprobin

Follow-up issue of #18844


As described in #63902, it would be good to remove comments and workarounds that have already been fixed.

So this workaround could be imo removed:

catch (FormatException) when (parameter.ParameterType == typeof(DateTime))
{
// Workaround for https://github.com/dotnet/runtime/issues/18844
// If HasDefaultValue throws FormatException for DateTime
// we expect it to have default value

I saw that there was a PR about this some time ago, which was closed due to compatibility issues with .NET 4.8.

Is this still the case?
If not, we could actually reactivate the PR (#42491).
If yes, maybe we should consider if a conditional compilation would make sense and that we only use the workaround under .NET 4.8.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions