NikolayXHD / Mtgdb

Mtgdb.Gui - desktop app to search MTG cards and build decks
https://www.slightlymagic.net/forum/viewtopic.php?f=62&t=19299
Other
63 stars 10 forks source link

On opening get stack trace #64

Closed robertmarkbram closed 3 years ago

robertmarkbram commented 3 years ago

Bug report

I modified C:\Users\Robert Bram\myApps\Mtgdb.Gui\etc\Mtgdb.Gui.xml to input the path to my Magic Arena card database file.

    <MtgaIntegration
        CardLibraryFile="%ProgramFiles(x86)%\Wizards of the Coast\MTGA\MTGA_Data\Downloads\Data\data_cards_ebdf71288e4a2f434833d248ae37e479.mtga"
        LogFile="%UserProfile%\AppData\LocalLow\Wizards Of The Coast\MTGA\output_log.txt"
    />

I don't think this caused the issue - reversing this change didn't change the app output. I downloaded card images too, using the UI controls.

Mtgdb.Gui version

4.1.1.1.

Steps to reproduce the bug

  1. I open the app.

Actual result (the bug)

  1. Stack trace error below.
  2. Inability to interact with the app after that.
Here you can download card images. After downloading images this window will stop showing up.
This notification can be disabled in Advanced settings menu
  in main window's title, left to color scheme icon,
  select Missing images notification: No

Installed version: Mtgdb.Gui.v4.1.1.1.zip
Downloaded images:
Art: 0/1 directories, 0/0 files
LQ: 0/433 directories, 0/47500 files
LQ-Token: 0/162 directories, 0/2095 files
MQ: 433/433 directories, 47500/47500 files
MQ-Token: 162/162 directories, 2095/2095 files

System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Mtgdb.Data.CardRepository.Load()
   at Mtgdb.Ui.Loader.<<createLoadingActions>b__4_2>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Mtgdb.TaskEx.<>c__DisplayClass2_0.<<Run>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Mtgdb.Ui.Loader.<<AsyncRun>b__3_0>d.MoveNext()

Expected result

  1. Be able to use the app.
NikolayXHD commented 3 years ago

Thnks for reporting, started working on it.

NikolayXHD commented 3 years ago

this is caused by duplicate card and token IDs in mtgjson.com data, see https://github.com/mtgjson/mtgjson/issues/812

NikolayXHD commented 3 years ago

Working on a workaround

NikolayXHD commented 3 years ago

fixed in 4.1.1.2