vadersharp icon indicating copy to clipboard operation
vadersharp copied to clipboard

FormatException: Input string was not in a correct format.

Open JohnWinner opened this issue 8 years ago • 3 comments

For your information your component is crashing right at initialization:

SentimentIntensityAnalyzer analyzer = new SentimentIntensityAnalyzer();

System.TypeInitializationException: 'The type initializer for 'VaderSharp.SentimentIntensityAnalyzer' threw an exception

FormatException: Input string was not in a correct format.

JohnWinner avatar Sep 29 '17 04:09 JohnWinner

I think it's because I have to create the "ConfigStore" somewhere. I'll figure it out...

JohnWinner avatar Sep 29 '17 04:09 JohnWinner

Hey John what version of .NET are you running? And does this happen even if you init in an empty project? If you can reproduce in a sample app I can take a look because it seems to be working okay for me.

codingupastorm avatar Sep 29 '17 20:09 codingupastorm

I had the same issue. I think that happens because you try to parse something like a double when German uses a , instead of a . or something...

Workaround: Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

@codingupastorm If you try to set the CurrentCulture to German it should be reproducable.

aaad avatar Dec 08 '17 19:12 aaad