Cross-thread operation not valid


Author
Message
Leonard P.
Leonard P.
StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)
Group: Awaiting Activation
Posts: 65, Visits: 306
Hi,



I am implementing clickable context menu with InfoBox. I am getting an error in Dispose when form is being closed after a user clicked on the context menu item. The error is "Cross-thread operation not valid: Control 'cmNotification' accessed from a thread other than the thread it was created on."



It's also happening in StrataFrame UI Control sample. But the strangest thing is that it happens in C# version of the sample only, I tired VB.NET version and it's working there Doze ?







Attachments
sf.PNG (160 views, 166.00 KB)
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Howdy Leonard Smile,

Yep, I was able to reproduce that error in the StrataFrame UI sample, so I will definately add it to the list of things to look at. That particular sample is getting a little long in the tooth, so I'm not sure whether the issue is with the implimentation or with the underlying source, but we'll look into it and let you know.

Thanks!

Leonard P.
Leonard P.
StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)StrataFrame Novice (83 reputation)
Group: Awaiting Activation
Posts: 65, Visits: 306
Thanks Dustin,



FYI, I tried adding InvokeRequired() check and BeginInvoke call to the menu onClick event, but that didn't seem to make a difference. I hope you have better luck with it.

I have a feeling the problem has to do with Context menu being created on UI thread and accessed on the InfoBox thread. It'd be interesting to know why it works in VB.NET and not in C#, please let me know how it turns out.





Thanks.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search