rhyous / WPFSharp.Globalizer

Other
26 stars 11 forks source link

Handle XamlReader.Load Exceptions #3

Closed lablabla closed 7 years ago

lablabla commented 8 years ago

Hi,

If there is an issue with the language XAML file (for example, multiple strings with the same key), a XamlParseException is thrown when LoadFromFile is called. try..catching the call to SwitchLanguage doesn't work.

This cause the entire program to crash. I would have expected in such case the the language will not be loaded into the AvailableLanguages, or maybe some other solution that would not result in a complete crash.

Thanks. Great project.

rhyous commented 8 years ago

Interesting. You added try/catch and it didn't catch? I just tried and it did catch the exception.

https://github.com/rhyous/WPFSharp.Globalizer/commit/614556363dd399ca533b34debe8e4595b74e618d

contagion commented 8 years ago

I've tried your latest update on this issue and it works great. Malformed XAML file and non-exist languages will not cause the entire program to crash anymore.

Would you be so kind to also update the nuget package ?

Thanks for the great project.

rhyous commented 8 years ago

I just published a new version of the NuGet package

rhyous commented 8 years ago

Please confirm the NuGet package is working and I will close this issue.