GuitarPro-to-Midi icon indicating copy to clipboard operation
GuitarPro-to-Midi copied to clipboard

Error: Index was out of range. (Parameter 'index')

Open DivannKokos opened this issue 2 years ago • 8 comments

gp file: https://tabs.ultimate-guitar.com/tab/my-chemical-romance/welcome-to-the-black-parade-guitar-pro-2704041 -v:

Error: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at GuitarProToMidi.GP6File.transferBars(Node node, GP5File song) in C:\repositories\GuitarPro-to-Midi\src\GuitarProToMidi.Console\GP6File.cs:line 158
   at GuitarProToMidi.GP6File.GP6NodeToGP5File(Node node) in C:\repositories\GuitarPro-to-Midi\src\GuitarProToMidi.Console\GP6File.cs:line 131
   at GuitarProToMidi.GP7File.readSong() in C:\repositories\GuitarPro-to-Midi\src\GuitarProToMidi.Console\GP7File.cs:line 20
   at GuitarProToMidi.GpFileParser.CreateMidiFile() in C:\repositories\GuitarPro-to-Midi\src\GuitarProToMidi.Console\GPFileParser.cs:line 53
   at GuitarProToMidi.Program.<>c__DisplayClass0_0.<Main>b__1() in C:\repositories\GuitarPro-to-Midi\src\GuitarProToMidi.Console\Program.cs:line 41
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at GuitarProToMidi.Program.Main(String[] args) in C:\repositories\GuitarPro-to-Midi\src\GuitarProToMidi.Console\Program.cs:line 53

this has been tried with build of standard branch, with build of branch of fix-index-out-of-range and with obviously standard exe in releases.

DivannKokos avatar May 13 '22 05:05 DivannKokos

it seems that i already got this error in last comment here: https://github.com/rageagainsthepc/GuitarPro-to-Midi/issues/14

DivannKokos avatar May 13 '22 05:05 DivannKokos

I tried creating GPs with one track at time, first drums then bass, and etc. I succefully convert every GP except GP with track of Piano.

DivannKokos avatar May 13 '22 05:05 DivannKokos

In this and file and last comment of #14 Problem has been fixed by turning Grand Staff to Single Staff in tracks of pianos image image

DivannKokos avatar May 13 '22 05:05 DivannKokos

Even the index-out-of-range branch? 🤔 I wasn't finished with that fix if I remember correctly. I'll look into it as time permits.

rageagainsthepc avatar May 17 '22 17:05 rageagainsthepc

Tested it for ya, the index-out-of-range branch does indeed fix this issue, but not if there is a "grand staff" track in there. I'm an experienced developer but looking to learn c# so if there are any issues for a beginner C# but experienced developer, I could give it a go.

frosit avatar Nov 21 '23 22:11 frosit

@frosit Well, if you want to see idiomatic C# code, I would not look at this project too closely ;) I wanted to refactor the code base gradually at some point, but got discouraged by the sheer size of that feat. But considering you already seem to know where the problem with the fix for this issue lies, why not start with that?

rageagainsthepc avatar Nov 22 '23 08:11 rageagainsthepc

I think that's roughly how the majority of github users think about roughly the majority of their code on this platform haha. It's partially what makes open source so great and at least I don't have to school you on using git 😉 thats when I really start to sweat haha. But thanks for the heads up, not looking to adapt bad practices so will make sure to inform myself properly on that elsewhere. I'll see where it brings me.

frosit avatar Nov 22 '23 09:11 frosit

Bear in mind that most of the code is not mine. I just forked the project and slapped some CLI around it. That means I am not really familiar with the code base myself, so don't expect too much in terms of insights into the inner workings and how things should behave.

rageagainsthepc avatar Nov 22 '23 13:11 rageagainsthepc