Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Reflection: Fix FormatException when querying ParameterInfo.DefaultValue of optional DateTime parameter #17877

Merged
1 commit merged into from
May 7, 2018

Commits on May 7, 2018

  1. Reflection: Fix DefaultValue for optional DateTime

    Querying the default value of an optional `DateTime` parameter using
    `ParameterInfo.DefaultValue` can throw a `FormatException` if that
    default value is a null constant in metadata, which is how the C#
    compiler encodes a default value of `default(DateTime)`.
    
    This commit fixes that error by adding the proper handling for null
    metadata constants with `DateTime` parameters.
    stakx committed May 7, 2018
    Configuration menu
    Copy the full SHA
    a063e1a View commit details
    Browse the repository at this point in the history