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

Remove ParameterInfo.HasDefaultValue workaround #65233

Closed
deeprobin opened this issue Feb 12, 2022 · 3 comments
Closed

Remove ParameterInfo.HasDefaultValue workaround #65233

deeprobin opened this issue Feb 12, 2022 · 3 comments
Labels
area-Extensions-DependencyInjection untriaged New issue has not been triaged by the area owner

Comments

@deeprobin
Copy link
Contributor

deeprobin commented Feb 12, 2022

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.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 12, 2022
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Feb 12, 2022

Tagging subscribers to this area: @dotnet/area-extensions-dependencyinjection
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: deeprobin
Assignees: -
Labels:

untriaged, area-Extensions-DependencyInjection

Milestone: -

@eerhardt
Copy link
Member

This code is in the .netstandard.cs file. The workaround has been removing on .NET Core, where the bug was fixed. But since we need to support netstandard (i.e. .NET Framework), we need to keep the workaround in place because the underlying issue isn't fixed there.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-DependencyInjection untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants