This project has moved. For the latest updates, please go here.

midi in problem: Object reference not set to an instance of an object.

May 28, 2012 at 9:11 AM
Edited May 28, 2012 at 9:16 AM

 

 

 

 

void midiIn_MessageReceived(object sender, MidiInMessageEventArgs e)

{

 

string message = e.MidiEvent.ToString();

}

 

 

System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  StackTrace:
       at window6.SliderBarKnob1.<>c__DisplayClass2.<midiIn_MessageReceived>b__0() in C:\Users\Gr.xaml.cs:line 179
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

 

 

 

 some times when reciv midi, no idea what message is coming, have this problem.
If you know what cause this, can tellme how can skip this problem with a example?

THK!

 

 

Coordinator
Jun 11, 2012 at 9:59 PM

is it e.MidiEvent itself that is null?

or is a null reference occurring in the ToString?

If you set your debugger to break on all errors you should be able to find this out

Jun 18, 2012 at 8:14 PM
Edited Jun 18, 2012 at 8:17 PM

Hi Mark
After try all what  can never can fix this problem.
I asume is a bug.

Please can take a look on this?

Inside the zip file i provide with virtual midi wire, called midi loop be 1

Please install that.

Then you can see my example.
For test  do this:

1 install midi virtual wire appz included.
2 the run the software i include in the zip, run vsthost.exe appz, is just a vst host appz.
Inside that software setup midi device to port of midi loop be 1, use the same port for MIDI IN and MIDI OUT
3, Now open my example, setup in same way midi in and midi out, then click on go to win1 button.
You can see the error.

Hoppe you can helpme with this, 100% stuck on this.

Here the download:    http://www.todosaca.com/files.zip

 

Please letme know!  :)


Jun 20, 2012 at 2:27 AM

Please tellme if can reproduce the test.

Bets regards.

Jun 22, 2012 at 8:55 AM

Mark sorry for insist, i know you handle the projetc in your free times.
Please asap you cna take a look on this, i borken my head trying to figure checkingthe source code f your lib why this happen but no idea yet.
Thankyou!

Coordinator
Jun 22, 2012 at 9:34 AM

hi GrobotoX. I'm afraid I don't have a lot of time to look into individual problems. I did try to set up your system, but I didn't get an error when clicking on the go to win1 button

Jun 22, 2012 at 10:15 AM

LOL!
Mark you helpme in anyway!
After see you cnat reproduce this test i dicover the version of midi loopbe1 i have installed no is the latest and that is what cause the problem.
After install the latest version the smae i send to you problem stoped!!  :)
Awesome!

Thankyou man!