Author Topic: Exit from program on deletion  (Read 660 times)

0 Members and 1 Guest are viewing this topic.

Offline Mickey3D

  • Velites
  • **
  • Posts: 42
Exit from program on deletion
« on: August 20, 2018, 03:05:41 PM »
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:

Quote
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=4.0.0.0, 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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Execute(System.__Canon)
   à GalaSoft.MvvmLight.CommandWpf.RelayCommand`1[[System.__Canon, mscorlib, Version=4.0.0.0, 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()

and

Quote
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.


Offline Andy ONeill

  • Moderator
  • Viking
  • *****
  • Posts: 349
Re: Exit from program on deletion
« Reply #1 on: August 21, 2018, 02:26:44 AM »
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.
But.
Army files saved prior to version 2018.8.21 will be broken.
I think if you renumber ids it might fix this issue though.


Offline Mickey3D

  • Velites
  • **
  • Posts: 42
Re: Exit from program on deletion
« Reply #2 on: August 21, 2018, 02:01:18 PM »
I have used the renumber ids and deletion is working now.  :bd:
« Last Edit: August 21, 2018, 02:03:19 PM by Mickey3D »

Offline Mickey3D

  • Velites
  • **
  • Posts: 42
Re: Exit from program on deletion
« Reply #3 on: August 21, 2018, 02:07:32 PM »
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.

Offline Andy ONeill

  • Moderator
  • Viking
  • *****
  • Posts: 349
Re: Exit from program on deletion
« Reply #4 on: August 22, 2018, 04:01:21 AM »
Sounds like a good idea.
That'd be Ezra.
I've emailed him in case he doesn't read this thread.


Offline Dr D Ezra Sidran

  • Velites
  • **
  • Posts: 34
    • General Staff
Re: Exit from program on deletion
« Reply #5 on: August 22, 2018, 05:52:14 AM »
I'm on it!

Offline Mickey3D

  • Velites
  • **
  • Posts: 42
Re: Exit from program on deletion
« Reply #6 on: August 22, 2018, 01:57:32 PM »
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 ?

Offline Mickey3D

  • Velites
  • **
  • Posts: 42
Re: Exit from program on deletion
« Reply #7 on: August 22, 2018, 02:16:25 PM »
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 ?

Offline Andy ONeill

  • Moderator
  • Viking
  • *****
  • Posts: 349
Re: Exit from program on deletion
« Reply #8 on: August 23, 2018, 03:47:39 AM »
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.
Oh.
Dates.
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.