Skip to content

Commit c4edda2

Browse files
committed
- Fix #155: unhandled exception looking at payee
- Fix #154: Clicking on a payee with no transactions shows invalid data - Fix #153: unhandled exception due to invalid char in account name Publish 2.1.0.49
1 parent 49c2eac commit c4edda2

File tree

12 files changed

+88
-60
lines changed

12 files changed

+88
-60
lines changed

Source/WPF/MoneyPackage/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap rescap">
3-
<Identity Name="43906ChrisLovett.MyMoney.Net" Publisher="CN=Chris Lovett, O=Chris Lovett, S=Washington, C=US" Version="2.1.0.48" />
3+
<Identity Name="43906ChrisLovett.MyMoney.Net" Publisher="CN=Chris Lovett, O=Chris Lovett, S=Washington, C=US" Version="2.1.0.49" />
44
<Properties>
55
<DisplayName>MyMoney.Net</DisplayName>
66
<PublisherDisplayName>Chris Lovett</PublisherDisplayName>

Source/WPF/MyMoney/Database/Money.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,6 +2248,8 @@ public Account GetFirstAccount()
22482248
}
22492249
return null;
22502250
}
2251+
2252+
public static readonly char[] InvalidNameChars = new char[] { '{', '}', ':', '*', '"', '/', '\\', '<', '>', '|', '?' };
22512253

22522254
public override void OnNameChanged(object o, string oldName, string newName)
22532255
{
@@ -4853,13 +4855,19 @@ public void AddPayee(Payee p)
48534855

48544856
public Payee FindPayee(string name, bool add)
48554857
{
4856-
if (name == null)
4858+
if (string.IsNullOrEmpty(name))
48574859
{
48584860
return null;
48594861
}
4860-
name = replaceWhitespaces.Replace(name, " ");
4862+
var normalized = replaceWhitespaces.Replace(name, " ");
4863+
var result = this.payeeIndex[normalized];
4864+
if (result == null)
4865+
{
4866+
// might need to lookup a legacy non-space normalized payee...
4867+
result = this.payeeIndex[name];
4868+
}
4869+
48614870
// find or add account of given name
4862-
Payee result = this.payeeIndex[name];
48634871
if (result == null && add)
48644872
{
48654873
result = this.AddPayee(this.nextPayee++);
@@ -4948,7 +4956,7 @@ public List<Payee> GetPayeesAsList()
49484956
{
49494957
foreach (Payee p in this.payees.Values)
49504958
{
4951-
if (!p.IsDeleted)
4959+
if (!p.IsDeleted && !string.IsNullOrEmpty(p.Name))
49524960
{
49534961
list.Add(p);
49544962
}

Source/WPF/MyMoney/Dialogs/AccountDialog.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
KeyDown="OnAccountAliasesKeyDown"/>
140140

141141
<TextBlock Text="Reconcile Warning:" Grid.Column="0" Grid.Row="20" HorizontalAlignment="Right" />
142-
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="20" HorizontalAlignment="Stretch">
142+
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="20" HorizontalAlignment="Stretch" Grid.ColumnSpan="2">
143143
<TextBox x:Name="TextBoxReconcileWarning" Text="{Binding Path=ReconcileWarning, Mode=TwoWay}" Width="50" TabIndex="13"
144144
ToolTip="Enter when you would like to see a warning reminding you to balance this account (for example, you might want this to be less than the number of statements kept by your bank)"/>
145145
<TextBlock Text="months" VerticalAlignment="Center" Margin="10,0,0,0"/>

Source/WPF/MyMoney/Dialogs/AccountDialog.xaml.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,13 @@ private void OnCancel(object sender, RoutedEventArgs e)
431431
}
432432
this.DialogResult = false;
433433
this.Close();
434-
}
435-
436-
private static readonly char[] InvalidNameChars = new char[] { '{', '}', ':' };
434+
}
437435

438436
private void OnNameChanged(object sender, TextChangedEventArgs e)
439437
{
440438
this.CheckButtonStates();
441439

442-
if (this.TextBoxName.Text.IndexOfAny(InvalidNameChars) >= 0)
440+
if (this.TextBoxName.Text.IndexOfAny(Accounts.InvalidNameChars) >= 0)
443441
{
444442
this.TextBoxName.Background = Brushes.Red;
445443
this.TextBoxName.ToolTip = Walkabout.Properties.Resources.AccountNameValidChars;

Source/WPF/MyMoney/Properties/PublishProfiles/ClickOnceProfile.pubxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project>
66
<PropertyGroup>
7-
<ApplicationRevision>48</ApplicationRevision>
8-
<ApplicationVersion>2.1.0.48</ApplicationVersion>
7+
<ApplicationRevision>49</ApplicationRevision>
8+
<ApplicationVersion>2.1.0.49</ApplicationVersion>
99
<BootstrapperEnabled>True</BootstrapperEnabled>
1010
<Configuration>Release</Configuration>
1111
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>

Source/WPF/MyMoney/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/WPF/MyMoney/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120120
<data name="AccountNameValidChars" xml:space="preserve">
121-
<value>Account name cannot contain the characters '{', '}' or ':'</value>
121+
<value>Account name cannot contain the characters '{', '}', ':', '*', '"', '/', '\\', '&lt;', '&gt;', '|', or '?'</value>
122122
</data>
123123
<data name="AccountTypeMismatch" xml:space="preserve">
124124
<value>Account '{0}' should be of type {1} in order to import these transactions.</value>

Source/WPF/MyMoney/Setup/changes.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<changes>
3+
<change version="2.1.0.49" date="3/10/2025">
4+
- Fix #155: unhandled exception looking at payee
5+
- Fix #154: Clicking on a payee with no transactions shows invalid data
6+
- Fix #153: unhandled exception due to invalid char in account name
7+
</change>
38
<change version="2.1.0.48" date="2/23/2025">
49
- Fix #152: CSV import should ignore currency symbols.
510
- Fix #150: unhandled exception

Source/WPF/MyMoney/Views/TransactionsView.xaml.cs

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,11 @@ public int SelectedRowIndex
17271727
get { return this.TheActiveGrid.SelectedIndex; }
17281728
set {
17291729
this.TheActiveGrid.SelectedIndex = value;
1730-
this.TheActiveGrid.ScrollIntoView(this.TheActiveGrid.SelectedItem);
1730+
var selected = this.TheActiveGrid.SelectedItem;
1731+
if (selected != null)
1732+
{
1733+
this.TheActiveGrid.ScrollIntoView(selected);
1734+
}
17311735
}
17321736
}
17331737

@@ -2017,20 +2021,23 @@ internal void ViewTransactionsForPayee(Payee p, long selectedRowId)
20172021
using (PerformanceBlock.Create(ComponentId.Money, CategoryId.View, MeasurementId.ViewTransactions))
20182022
{
20192023
#endif
2020-
// make sure it's real payee
2024+
string caption = "Payments";
20212025
p = this.myMoney.Payees.FindPayee(p.Name, false);
2026+
IList<Transaction> transactions = new List<Transaction>();
20222027
if (p != null)
20232028
{
2024-
this.FireBeforeViewStateChanged();
2025-
this.fixedList = null;
2026-
this.lastQuery = null;
2027-
this.SwitchLayout("TheGrid_TransactionFromDetails");
2028-
this.SetActiveAccount(null, null, p, null, null);
2029-
IList<Transaction> transactions = this.myMoney.Transactions.GetTransactionsByPayee(p, this.GetTransactionIncludePredicate());
2030-
var data = new TransactionCollection(this.myMoney, null, transactions, true, false, this.QuickFilter);
2031-
this.Display(data, TransactionViewName.ByPayee, "Payments to " + p.Name, selectedRowId);
2032-
this.FireAfterViewStateChanged(selectedRowId);
2029+
caption = "Payments to " + p.Name;
2030+
transactions = this.myMoney.Transactions.GetTransactionsByPayee(p, this.GetTransactionIncludePredicate());
20332031
}
2032+
var data = new TransactionCollection(this.myMoney, null, transactions, true, false, this.QuickFilter);
2033+
this.FireBeforeViewStateChanged();
2034+
this.fixedList = null;
2035+
this.lastQuery = null;
2036+
this.SwitchLayout("TheGrid_TransactionFromDetails");
2037+
this.SetActiveAccount(null, null, p, null, null);
2038+
this.Display(data, TransactionViewName.ByPayee, caption, selectedRowId);
2039+
this.FireAfterViewStateChanged(selectedRowId);
2040+
20342041
#if PerformanceBlocks
20352042
}
20362043
#endif
@@ -2042,13 +2049,10 @@ internal void ViewTransactionsForSecurity(Security s, long selectedRowId)
20422049
using (PerformanceBlock.Create(ComponentId.Money, CategoryId.View, MeasurementId.ViewTransactions))
20432050
{
20442051
#endif
2052+
IList<Transaction> transactions = new List<Transaction>();
20452053
if (s != null)
20462054
{
2047-
this.FireBeforeViewStateChanged();
2048-
this.fixedList = null;
2049-
this.lastQuery = null;
2050-
var transactions = this.RefreshViewBySecurity(s, selectedRowId);
2051-
this.FireAfterViewStateChanged(selectedRowId);
2055+
transactions = this.RefreshViewBySecurity(s, selectedRowId);
20522056

20532057
// Async load of security info.
20542058
var mgr = (StockQuoteManager)this.site.GetService(typeof(StockQuoteManager));
@@ -2062,6 +2066,11 @@ internal void ViewTransactionsForSecurity(Security s, long selectedRowId)
20622066
}
20632067
}
20642068
}
2069+
2070+
this.FireBeforeViewStateChanged();
2071+
this.fixedList = null;
2072+
this.lastQuery = null;
2073+
this.FireAfterViewStateChanged(selectedRowId);
20652074
#if PerformanceBlocks
20662075
}
20672076
#endif
@@ -2174,18 +2183,21 @@ internal void ViewTransactionsForCategory(Category c, long selectedRowId)
21742183
using (PerformanceBlock.Create(ComponentId.Money, CategoryId.View, MeasurementId.ViewTransactions))
21752184
{
21762185
#endif
2186+
string caption = "Transactions by Category";
2187+
IList<Transaction> transactions = new List<Transaction>();
21772188
if (c != null)
21782189
{
2179-
this.FireBeforeViewStateChanged();
2180-
this.fixedList = null;
2181-
this.lastQuery = null;
2182-
this.SwitchLayout("TheGrid_TransactionFromDetails");
2183-
this.SetActiveAccount(null, c, null, null, null);
2184-
IList<Transaction> transactions = this.myMoney.Transactions.GetTransactionsByCategory(c, this.GetTransactionIncludePredicate());
2185-
var data = new TransactionCollection(this.myMoney, null, transactions, true, false, this.QuickFilter);
2186-
this.Display(data, TransactionViewName.ByCategory, "Transactions by Category " + c.Name, selectedRowId);
2187-
this.FireAfterViewStateChanged(selectedRowId);
2190+
caption += " " + c.Name;
2191+
transactions = this.myMoney.Transactions.GetTransactionsByCategory(c, this.GetTransactionIncludePredicate());
21882192
}
2193+
this.FireBeforeViewStateChanged();
2194+
this.fixedList = null;
2195+
this.lastQuery = null;
2196+
this.SwitchLayout("TheGrid_TransactionFromDetails");
2197+
this.SetActiveAccount(null, c, null, null, null);
2198+
var data = new TransactionCollection(this.myMoney, null, transactions, true, false, this.QuickFilter);
2199+
this.Display(data, TransactionViewName.ByCategory, caption, selectedRowId);
2200+
this.FireAfterViewStateChanged(selectedRowId);
21892201
#if PerformanceBlocks
21902202
}
21912203
#endif
@@ -2197,17 +2209,20 @@ internal void ViewTransactionsForCategory(Category c, IEnumerable<Transaction> l
21972209
using (PerformanceBlock.Create(ComponentId.Money, CategoryId.View, MeasurementId.ViewTransactions))
21982210
{
21992211
#endif
2212+
string caption = "Transactions by Category";
2213+
IList<Transaction> transactions = new List<Transaction>();
22002214
if (c != null)
22012215
{
2202-
this.FireBeforeViewStateChanged();
2203-
this.fixedList = null;
2204-
this.lastQuery = null;
2205-
this.SwitchLayout("TheGrid_TransactionFromDetails");
2206-
this.SetActiveAccount(null, c, null, null, null);
2207-
var data = new TransactionCollection(this.myMoney, null, list, true, false, this.QuickFilter);
2208-
this.Display(data, TransactionViewName.ByCategoryCustom, "Transactions by Category " + c.Name, this.SelectedRowId);
2209-
this.FireAfterViewStateChanged(this.SelectedRowId);
2216+
caption += " " + c.Name;
22102217
}
2218+
this.FireBeforeViewStateChanged();
2219+
this.fixedList = null;
2220+
this.lastQuery = null;
2221+
this.SwitchLayout("TheGrid_TransactionFromDetails");
2222+
this.SetActiveAccount(null, c, null, null, null);
2223+
var data = new TransactionCollection(this.myMoney, null, list, true, false, this.QuickFilter);
2224+
this.Display(data, TransactionViewName.ByCategoryCustom, caption, this.SelectedRowId);
2225+
this.FireAfterViewStateChanged(this.SelectedRowId);
22112226

22122227
#if PerformanceBlocks
22132228
}
@@ -2220,17 +2235,19 @@ internal void ViewTransactionsForPayee(Payee p, IEnumerable<Transaction> list)
22202235
using (PerformanceBlock.Create(ComponentId.Money, CategoryId.View, MeasurementId.ViewTransactions))
22212236
{
22222237
#endif
2238+
string caption = "Transactions by Payee";
22232239
if (p != null)
22242240
{
2225-
this.FireBeforeViewStateChanged();
2226-
this.fixedList = null;
2227-
this.lastQuery = null;
2228-
this.SwitchLayout("TheGrid_TransactionFromDetails");
2229-
this.SetActiveAccount(null, null, p, null, null);
2230-
var data = new TransactionCollection(this.myMoney, null, list, true, false, this.QuickFilter);
2231-
this.Display(data, TransactionViewName.ByCategoryCustom, "Transactions by Payee " + p.Name, this.SelectedRowId);
2232-
this.FireAfterViewStateChanged(this.SelectedRowId);
2241+
caption += " " + p.Name;
22332242
}
2243+
this.FireBeforeViewStateChanged();
2244+
this.fixedList = null;
2245+
this.lastQuery = null;
2246+
this.SwitchLayout("TheGrid_TransactionFromDetails");
2247+
this.SetActiveAccount(null, null, p, null, null);
2248+
var data = new TransactionCollection(this.myMoney, null, list, true, false, this.QuickFilter);
2249+
this.Display(data, TransactionViewName.ByCategoryCustom, caption, this.SelectedRowId);
2250+
this.FireAfterViewStateChanged(this.SelectedRowId);
22342251

22352252
#if PerformanceBlocks
22362253
}

Source/WPF/Version/Version.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
// And also sync this with the MSIX package manifest in
77
// ~\MyMoney.Net\Source\WPF\MoneyPackage\Package.appxmanifest
88

9-
[assembly: AssemblyVersion("2.1.0.48")]
10-
[assembly: AssemblyFileVersion("2.1.0.48")]
9+
[assembly: AssemblyVersion("2.1.0.49")]
10+
[assembly: AssemblyFileVersion("2.1.0.49")]

0 commit comments

Comments
 (0)