Exit from program on deletion

Started by Mickey3D, August 20, 2018, 04:05:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I'm using the latest version from the download site. I load an army file, select an element and click on "delete". The program closes and the following errors appear in the Windows events log:

Application : GSBPArmyEditor.exe
Version du Framework : v4.0.30319
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.InvalidOperationException
   à System.Linq.Enumerable.SingleOrDefault[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   à ArmyEditor.MainWindowViewModel.<get_DeleteCommand>b__53_0(ArmyEditor.UnitVM)

Informations sur l'exception : System.Reflection.TargetInvocationException
   à System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
   à System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
   à System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   à GalaSoft.MvvmLight.Helpers.WeakAction`1[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Execute(System.__Canon)
   à GalaSoft.MvvmLight.CommandWpf.RelayCommand`1[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Execute(System.Object)
   à MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, Boolean)
   à System.Windows.Controls.Primitives.ButtonBase.OnClick()
   à System.Windows.Controls.Button.OnClick()
   à System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
   à System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   à System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   à System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   à System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
   à System.Windows.UIElement.OnMouseUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
   à System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   à System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   à System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   à System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   à System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
   à System.Windows.Input.InputManager.ProcessStagingArea()
   à System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   à System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
   à System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
   à System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
   à System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   à MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   à MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   à System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   à MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   à System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   à System.Windows.Application.RunDispatcher(System.Object)
   à System.Windows.Application.RunInternal(System.Windows.Window)
   à ArmyEditor.App.Main()


Nom de l’application défaillante GSBPArmyEditor.exe, version : 0.2018.8.18, horodatage : 0x5b794726
Nom du module défaillant : KERNELBASE.dll, version : 10.0.17134.165, horodatage : 0xb0bb231d
Code d’exception : 0xe0434352
Décalage d’erreur : 0x000000000003a388
ID du processus défaillant : 0x166c
Heure de début de l’application défaillante : 0x01d438c8e4ac6b26
Chemin d’accès de l’application défaillante : D:\Program Files (x86)\GeneralStaff\BlackPowder\GSBPArmyEditor\GSBPArmyEditor.exe
Chemin d’accès du module défaillant: C:\WINDOWS\System32\KERNELBASE.dll
ID de rapport : c840577c-519a-499a-9841-71fd67378ffe
Nom complet du package défaillant :
ID de l’application relative au package défaillant :

P.S.: It would be nice to have a version number in the "About" windows to easily ensure we are using the latest version.

Andy ONeill

Great idea, I've added the version number to the about window.

Also fixed the deletion thing.
I think.
The problem was because the IDs of units were getting set to 0 on save.
When you reload, everything looks ok because a unit has a collection of subordinates ( units ) and there they are.
On any delete it goes to find the unit's parent using ID and finds multiple ones when expecting exactly 1.

Fixed that.
Army files saved prior to version 2018.8.21 will be broken.
I think if you renumber ids it might fix this issue though.


I have used the renumber ids and deletion is working now.  :bd:


Quote from: Andy ONeill on August 21, 2018, 03:26:44 AM
I've added the version number to the about window

It would be nice to add it also on the army editor download page so the testers can quickly check if there is a new version.

Andy ONeill

Sounds like a good idea.
That'd be Ezra.
I've emailed him in case he doesn't read this thread.

Dr D Ezra Sidran


I don't know if I'm doing something wrong but on the download page version is "August 20, 2018" and after installation version is "18 August 2018" on the About window ?


Regarding the version number, I'm not sure the date is the best choice : later you might have to generate several versions per day.

May be you should use the .Net ability to automatically generate application version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assemblyversionattribute?redirectedfrom=MSDN&view=netframework-4.7.2 ?

Andy ONeill

I use a visual studio add in that can increment build or apply date.

There are several attributes for version numbers.
The one you see in programmes and features is from the installer and a property on the installer project.
Installer projects are another add in and pretty good for simple installs, easy to set them up.
Very fiddly for precise control.

Where was I.
The reason I like dates is because they're simple and clear.
You can look at it and think "Ah... ok that's the 21st.... and easily compare to the changelog without an indirect lookup of version number x must then have been dated whatever.

Ezra and I are in different time zones and any time anything is put into beta he will test it.
That means more than one version per day is highly unlikely for at least beta.
When we're live we are likely to change the numbering because it's manual and a point of failure.
I can't really see multiple hot fixes per day happening even then though.
Most commercial apps I work on, we usually do 1 release a week at most.
On Monday.
You then have 4 working days to sort out any urgent problems.