Invalidate() - NotSupportedException

using Visual Studio 2005 beta 2 / Compact Framework 2.0

I simply call Invalidate from a method within my Form and i get this ->

"An unhandled exception of type 'System.NotSupportedException' occurred in System.Drawing.dll

Additional information: An error message cannot be displayed because an optional resource assembly containing it cannot be found"

Any idea


Answer this question

Invalidate() - NotSupportedException

  • Gane

    This smells like a bug, post a report on the Microsoft Product Feedback Center with code to reproduce it.

  • RCN

    I have re-aranged my code since then, but I remember trying it a few places before posting here.  One of them was in a datareceived event method on a SerialPort object.  I ended up havin to use CreateGraphics to get around it, but playing around tonight found that indeed Update()/Refresh() work now so who knows, but i won't be testing it it back in the serial port thing.  This was before I knew about threads or invoke.

  • ernesto che

    Hi Adiraz,

    Note that SerialPort events are handled by a ThreadPool thread so if you need to update any properties for a GUI control, you would need to use Control.Invoke() instead of setting them directly.

    Cheers,
    Anthony

  • PatriotB

    Adiraz,

    From which method in your Form are you calling Invalidate() Are you on a different thread Just prior to calling Invalidate(), what does this.InvokeRequired return



  • Invalidate() - NotSupportedException