You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to create a custom type provider to handle Option<_> in F#.
Options replace null - essentially. However, the code on Line 354 says
configValue != null && TryConvertValue(...)
Which means now, it will just switch to trying to create a default type using an empty constructor (Activator.CreateInstance), referenced on line 377 instance = CreateInstance(type); which does:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
So these lines:
runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs
Lines 354 to 378 in c6d0daf
I was trying to create a custom type provider to handle
Option<_>
in F#.Options replace null - essentially. However, the code on Line 354 says
Which means now, it will just switch to trying to create a default type using an empty constructor (
Activator.CreateInstance
), referenced on line 377instance = CreateInstance(type);
which does:Option doesn't have a default constructor... so now I can't handle a null configValue and convert to a type without an empty constructor.
Which seems flawed to me.
Is there a reason behind this logic, or just a missed use case?
Beta Was this translation helpful? Give feedback.
All reactions