Hi,
My app sometimes throw this exception:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
There is NO WAY how to reproduce it. I would say that chance it happens is around 1 in 500. It always happens at a different time and at a different place (It has never happened during RecreateHandle).
So, I'm investigating nonstandard stuff I'm doing, and this comes to attention - I have a control that inherits from RichTextbox, and inside it, I have this method:
Public Sub FixScrollbars()
RecreateHandle
End Sub
Why I need it - see http://stackoverflow.com/questions/3036043/force-richtextbox-scrollbars-to-refresh/3036137#3036137
Do you think it's possible that calling RecreateHandle of Richtextbox could ultimately lead to AccessViolationException down the road?
Thanks for your thoughts.