Setting with empty value fails to convert to null-string
See original GitHub issueGiving following .ini-file and class:
[FOO]
SETTING=
public class FOO
{
public string? SETTING { get; set; }
}
Reading the file with 3.2.9.1, which was written with 3.2.8, and mapping the Section
object to an actual object with SetValuesTo(object)
now fails with:
SharpConfig.SettingValueCastException: Failed to convert value '' to type System.String.
at SharpConfig.Setting.CreateObjectFromString(String value, Type dstType, Boolean tryConvert)
at SharpConfig.Setting.GetValue(Type type)
at SharpConfig.Section.SetValuesTo(Object obj)
at MY CODE ^^
There is no workaround available, since the default (false
) for the tryConvert
parameter of Setting.CreateObjectFromString
is never overwritten!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Trigger to convert empty string to 'null' before it posts in ...
I suspect because this value is sent back as an empty string "" which does not translate to the null allowable data type....
Read more >getting Transformation Error while converting empty string ...
I have a Expression Transformation that converts input string to a date. Input is of format MM/DD/YYYY (from SQLServer source table).
Read more >Everything you wanted to know about $null - PowerShell
You can think of NULL as an unknown or empty value. A variable is NULL until you assign a value or an object...
Read more >ADF Copy Activity not converting empty string to null for ...
I am using Copy Activity to transfer data from CSV files on Azure Data Lake Gen2 to Synapse table using partition discovery and...
Read more >Postgresql null to empty string. Hot Network … If you need to r
In other words, the NULL column does not have any value. ... Your incoming empty string will be parsed and converted to a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Noted. Thanks for reporting these issues by the way.
Hi, and thanks for the prompt follow-up!
Mea culpa, I have a custom
string
-converter, which returnsnull
rather thanstring.Empty
which makes the following comparison fail.I’ve updated the title accordingly.