this.Invoke((MethodInvoker)delegate
{ code;
});
This results in exception as
Cannot access a disposed object. Object name: ‘…’.
How to handle this??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
InnerExceptionproperty of TargetInvocationException contains information you need to investigate (see Reflection MethodInfo.Invoke() catch exceptions from inside the method for sample).In your case it looks like you are accessing some disposed objects (like closed streams) in your delegate. Not much to do with Invoke itself.