question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting with empty value fails to convert to null-string

See original GitHub issue

Giving 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:open
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
cemderviscommented, Jun 4, 2020

Noted. Thanks for reporting these issues by the way.

1reaction
dittodholecommented, Jun 4, 2020

Hi, and thanks for the prompt follow-up!

Mea culpa, I have a custom string-converter, which returns null rather than string.Empty which makes the following comparison fail.

I’ve updated the title accordingly.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found