Random Crash in my .NET Program

G

Guest

I am getting a random crash in my program. I think it has to do with the
only listbox I have. It uses the WMP to play songs and when a song completes
I set the selected item in the listbox. I am assuming that is has to do with
the listbox because of this line:

"at System.Windows.Forms.ScrollableControl.WndProc(Message& m)"

and the listbox is the only part of my program that has a scrollable control.


Any help in fixing this would be greatly appreciated.

Here is the debug info:

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.



************** Exception Text **************

System.NullReferenceException: Object reference not set to an instance of an
object.

at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)

at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)

at System.Windows.Forms.Control.DefWndProc(Message& m)

at System.Windows.Forms.Control.WmUpdateUIState(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

at System.Windows.Forms.ContainerControl.WndProc(Message& m)

at System.Windows.Forms.ParkingWindow.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)


Thanks,

Renzska
 
G

Guest

public void setSelected(int track)
{
listFormPlayList.SetSelected(track, true);
}

That is what I am doing. But I call it in a lot of different places. Could
that be the cause of my problem?

Thanks,

Renzska
 
S

Sebastian Dau

Hello,

NullReferenceExceptions in this native methods mostly happen
when own code mixes something up while running inside
of the native window thread.

Are your sure that track in your method call

listFormPlayList.SetSelected(track, true);

is not set to some value out of range?


Greets, Sebastian Dau
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top