NickvisionApps / Denaro

Manage your personal finances
https://flathub.org/apps/details/org.nickvision.money
MIT License
574 stars 38 forks source link

System.ArgumentException: The value cannot be an empty string #604

Closed vanillajonathan closed 1 year ago

vanillajonathan commented 1 year ago
  1. Open Denaro.
  2. At the welcome screen click on one of the recent accounts.
$ flatpak run org.nickvision.money

(process:2): Adwaita-WARNING **: 11:44:52.233: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead.

(NickvisionMoney.GNOME:2): Gtk-CRITICAL **: 11:44:52.715: gtk_widget_get_parent: assertion 'GTK_IS_WIDGET (widget)' failed

(NickvisionMoney.GNOME:2): Gtk-CRITICAL **: 11:44:52.715: gtk_widget_add_css_class: assertion 'GTK_IS_WIDGET (widget)' failed
Unhandled exception. System.ArgumentException: The value cannot be an empty string. (Parameter 'value')
   at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName)
   at System.Globalization.NumberFormatInfo.set_CurrencyDecimalSeparator(String value)
   at NickvisionMoney.Shared.Controllers.AccountViewController.get_CultureForNumberString() in /run/build/org.nickvision.money/NickvisionMoney.Shared/Controllers/AccountViewController.cs:line 216
   at NickvisionMoney.GNOME.Views.AccountView.CreateGroupRow(IntPtr data) in /run/build/org.nickvision.money/NickvisionMoney.GNOME/Views/AccountView.cs:line 385

https://github.com/NickvisionApps/Denaro/blob/b1d7986d2e3ee31265599f01e15fb2b5a99f12b4/NickvisionMoney.Shared/Controllers/AccountViewController.cs#L216

https://github.com/NickvisionApps/Denaro/blob/b1d7986d2e3ee31265599f01e15fb2b5a99f12b4/NickvisionMoney.GNOME/Views/AccountView.cs#L385

Denaro version 2023.6.2.

nlogozzo commented 1 year ago

Can you type locale in the terminal and paste the results here?

nlogozzo commented 1 year ago

Also, does this happen with any account you try to open?

vanillajonathan commented 1 year ago

Can you type locale in the terminal and paste the results here?

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=sv_SE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=sv_SE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=sv_SE.UTF-8
LC_NAME=sv_SE.UTF-8
LC_ADDRESS=sv_SE.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=sv_SE.UTF-8
LC_ALL=

Also, does this happen with any account you try to open?

~I have two accounts, it happens on both accounts, but it doesn't always happen on both accounts. Sometimes I can open both. The application crashes, I try again, and then it works.~

nlogozzo commented 1 year ago

I have two accounts, it happens on both accounts, but it doesn't always happen on both accounts. Sometimes I can open both. The application crashes, I try again, and then it works.

Have you configured custom currencies for these accounts? If so, please provide those settings here.

vanillajonathan commented 1 year ago

Yeah, I use custom currencies.

Currency symbol: SEK Currency code: SEK Decimal separator: . Group separator: , Decimal digits: Two

vanillajonathan commented 1 year ago

I was wrong earlier when I said that both accounts sometimes work and both sometimes does not work. The last opened one gets moved to the top of the recent list, so I thought I was opening different ones. One of my accounts always causes Denaro to crash.

nlogozzo commented 1 year ago

One of my accounts always causes Denaro to crash.

That is the one with the custom currency, correct?

One last question, is this account password-protected?

vanillajonathan commented 1 year ago

That is the one with the custom currency, correct?

The one with the custom currency works. The one that doesn't work, I don't know what currency settings it has since I cannot open it and I don't remember it.

One last question, is this account password-protected?

No, it is not.

fsobolev commented 1 year ago

The one that doesn't work, I don't know what currency settings it has since I cannot open it and I don't remember it.

If it's not password-protected, you should still be able to open the account file in DB Browser. In the second tab select metadata table and there you can scroll to see all values.

image

vanillajonathan commented 1 year ago

I can open it with DB Browser.

id: 0 name: Example type: 0 useCustomCurrency: 1 customSymbol: ^ customCode: defaultTransactionType: 0 showGroupsList: 1 sortFirstToLast: 1 sortTransactionsBy: 0 customDecimalSeparator: customGroupSeparator: empty customDecimalDigits: 2

fsobolev commented 1 year ago

@vanillajonathan try placing . to customDecimalSeparator, this should recover your account file, so you'll be able to open it in Denaro... I hope. Please let us know about the result. But sure that's remporary solution, we'll look how this can be possible to set empty decimal separator (this is not expected, the app requires decimal separator symbol). If you can reproduce the issue, please tell us how you managed to do that.

vanillajonathan commented 1 year ago

That fixed it.

The application should probably handle it somehow, maybe with a fallback or with an error message rather than outright crash.

fsobolev commented 1 year ago

The application should probably handle it somehow, maybe with a fallback or with an error message rather than outright crash.

It shouldn't allow setting empty decimal separator at all, that's why asked if you can reproduce the issue.

nlogozzo commented 1 year ago

Yeah somehow the custom currency got corrupted and was blank even though you set it.

The application falls back to your system currency when the custom one is null, but it should also fallback when it's empty, hence why it crashes now. Will be fixed in the next update

vanillajonathan commented 1 year ago

I cannot reproduce the error.

Maybe the application should still be able to detect if the database is messy and do something else than crash.

nlogozzo commented 1 year ago

Maybe the application should still be able to detect if the database is messy and do something else than crash.

That's what my above comment will solve :)

nlogozzo commented 1 year ago

https://github.com/NickvisionApps/Denaro/releases/tag/2023.8.0-beta1