tebjan / Sanford.Multimedia.Midi

Full sources of the famous C# MIDI toolkit on CodeProject by Leslie Sanford
http://www.codeproject.com/Articles/6228/C-MIDI-Toolkit
MIT License
168 stars 63 forks source link

.Net v4.5 Version #7

Closed J0nKn1ght closed 8 years ago

J0nKn1ght commented 8 years ago

Hi, I'm trying to compile this for .Net v4.5/4.6, but there is an interop issue that causes an exception on the following line in the InputDeviceMessaging.cs file (line 152):

MidiHeader header = (MidiHeader)Marshal.PtrToStructure(headerPtr, typeof(MidiHeader));

The exception is: Additional information: The runtime has encountered a fatal error. The address of the error was at 0x24e7cfa4, on thread 0x108c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

I'm obviously not an interop expert, so I was wondering if you knew of a workaround for this exception?

Thanks.

mweetman2 commented 8 years ago

Hi Take a look at the other issue raised for this project. I think this is the same problem.

J0nKn1ght commented 8 years ago

Thanks, @mweetman2 - I should have read the other issue more closely! I'll close this one.

mweetman2 commented 8 years ago

Great. I saw the same issue as you, then started looking at the HandleSysExMessage routine, & couldn’t see why it was being called at all. The explanation of truncated pointers would seem to be a good suggestion from uckuper.

Regards

Martin Weetman

Phone +44 7798 903766

http://www.weetman.com

From: J0nKn1ght [mailto:notifications@github.com] Sent: 18 August 2016 09:10 To: tebjan/Sanford.Multimedia.Midi Cc: mweetman2; Mention Subject: Re: [tebjan/Sanford.Multimedia.Midi] .Net v4.5 Version (#7)

Thanks, @mweetman2 https://github.com/mweetman2 - I should have read the other issue more closely! I'll close this one.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tebjan/Sanford.Multimedia.Midi/issues/7#issuecomment-240653626 , or mute the thread https://github.com/notifications/unsubscribe-auth/ALpxF8J_fchh_3hOP3xAJlb58tbnAwtAks5qhBNdgaJpZM4JlnvD . https://github.com/notifications/beacon/ALpxF0tkXpgC8yfvGghzPK6k9uldtzUCks5qhBNdgaJpZM4JlnvD.gif