question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intermittent "Undefined external error" takes down app when debugging

See original GitHub issue

I’ve just started using the library, and love it… but I’ve got a problem that I don’t yet understand.

I’ve only seen it when using a “Fore” MIDI to USB cable (the actual MIDI device it’s talking to doesn’t seem to matter) but it seems that if it’s going to happen, it happens the first time I try to play a file on any device. If it works once, it keeps working until the process is finished. When it does fail, which has always been while debugging, so far, it takes down the process.

This is the exception:

Melanchall.DryWetMidi.Devices.MidiDeviceException
  HResult=0x80131500
  Message=Undefined external error.
  Source=Melanchall.DryWetMidi
  StackTrace:
   at Melanchall.DryWetMidi.Devices.MidiDevice.ProcessMmResult(UInt32 mmResult)
   at Melanchall.DryWetMidi.Devices.OutputDevice.SendShortEvent(MidiEvent midiEvent)
   at Melanchall.DryWetMidi.Devices.OutputDevice.SendEvent(MidiEvent midiEvent)
   at Melanchall.DryWetMidi.Devices.Playback.OnClockTicked(Object sender, EventArgs e)
   at Melanchall.DryWetMidi.Devices.MidiClock.OnTicked()
   at Melanchall.DryWetMidi.Devices.MidiClock.Tick()
   at Melanchall.DryWetMidi.Devices.MidiClock.OnTickGenerated(Object sender, EventArgs e)
   at Melanchall.DryWetMidi.Devices.TickGenerator.GenerateTick()
   at Melanchall.DryWetMidi.Devices.HighPrecisionTickGenerator.OnTick(UInt32 uID, UInt32 uMsg, UInt32 dwUser, UInt32 dw1, UInt32 dw2)

The code is reasonably simple - it’s in a WPF app:

var devices = OutputDevice.GetAll().ToList();
var outputDevice = devices.First(d => d.Name == "USB Midi ");
MidiFile file = MidiFile.Read(midiFileName);
var playback = file.GetPlayback(outputDevice);
var duration = playback.GetDuration<MetricTimeSpan>();
playback.InterruptNotesOnStop = true;
playback.Start();

The exception looks like it’s in a library-specific thread. Any thoughts around how I can diagnose this any further? Should I be looking for updated drivers?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
melanchallcommented, May 26, 2021

Well, I’ll add discussed API, build prerelease package and let you know.

Thanks for the issue!

0reactions
jskeetcommented, Jun 20, 2021

Excellent, will do - thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bizarre Intermittent Javascript Bug While Using P5.js in ...
I sometimes get the error a is undefined on crashed runs of the app. This one does not make sense to me since...
Read more >
Can not debug (edit and continue) with "On error goto"
Hi,. I am using VS 2019 (VB.net) and I can not edit and continue when debugging when I have "On error goto" I...
Read more >
How to debug client-side issues in AEM Touch UI or Classic UI
Open the page in Chrome Browser to the page that has error. · In Chrome browser (on the top right-side), go to Tools...
Read more >
Windows MIDI Bug: Undefined External Error [renamed ...
Since I use this notebook for music application only, there were not too much devices in the list. I deinstalled/reinstalled the NI-driver, rebooted...
Read more >
403 Forbidden Error: What It Is and How to Fix It
The 403 Forbidden Error is an HTTP response status code that indicates an identified client does not have proper authorization to access the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found