I got weird problem which might be threading related. I got 3. party
component which feeds my singleton dataclass properties. My dataclass offers public propeties and some public methods to send messages into 3. party component. In the end I use instance of my dataclass in multiple windows as showing those properties or sending messages to component.
Problem comes when quit my program and dispose my dataclass. At the disposing I have to call 3. party component to stop its thread channel.Stopthread(). which
SOMETIMES throws indexoutof range exception. But when I but messagebox.show("just
click ok") just before
that error never happens (what is that trick!?).
I did also simple wpf app where I use directly 3. party component and I was able to spam
as long I wanted without errors..
Also odd thing is that when I but
statement it never catches that error.
UPDATE: Here is some code at uninitialize
private void Uninitialize()
channel.MessageReceived -= new EventHandler<MessageEventArgs>(MessageReceived);
public void StopThread()
if (this.thread != null)
this.threadStop = true;
internal void SetEvent(params Object args)
And that is pretty much I'm able dig in about 3. party component. As you might noticed this is empedded device related application and I cannot debug this on development computer. My tracelog tells that programs crashes at channel.StopThread call.
I know that this is trivial to you also but any advice is would be great because im totally novice what comes to threading.
Hope to hear your thougths :)