System windows forms control marshaledinvoke




















But System. Control contains only Invoke Delegate method, params Object[] args method but not Invoke Delegate method, Object[] args. And I use it like. Yes you should. It takes an array of objects. Actually I think it's complaining that you're passing the wrong number of parameters for SetX to use. What parameters does SetX take? Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.

Learn more. Asked 10 years, 11 months ago. Active 10 years, 11 months ago. Viewed 3k times. I got an exeption like System. Control is an instance of DataGridView. This occurs very very rarely. Here is the stack trace:. Unhandled Execption: System. Must be non-negative and less than the size of the collection. Parameter name: index at System. Invoke Delegate method, Object[] args at Dashboard. ExecuteWorkItem at System.

Dispatch at System. I'm not clear on which object to test for null. Do you mean test Mthd object in my SmartInvoke? I suspect the problem is occuring in one of your event handlers and you need to check the passed parameters to make sure they are not null. You've provided very useful info and a very reasonable explanation. I will modify my code to catch, log and rethrow the exception. I still don't quite understand "A null object is normally -1". Can you provide an example where a null object can cause the ArgumentOutOfRangeException exception to be raised?

I don't believe the issue is with Control. That may be where the exception is being realized, but I don't think any of the lock statements you mention have anything to do with it. MarshaledInvoke doesn't directly throw any ArgumentExceptions, which means that something happened previously.

As Mike mentions, it is likely in the method being invoked or in a code path that the invoked method takes. In addition to what the others have mentioned, I would suggest attaching a debugger debugging and breaking on 1st chance System.

That should show you the culprit. Your thoughts are inline with Mike and Joel. Thanks again to Overdrive aka AdamJ J. View this "Best Answer" in the replies below ». Verify your account to enable IT peers to see that you are a professional. Thanks, looks promising, I'm just backing up the database and will give it a go. Ah sadly no dice! Exactly the same error from this script as well.

Adam AJ Tek Mace. Adam AJ Tek This person is a verified professional. Windows Server expert. Pm me and I will help you through it I'm on vacation so expect delayed responses. This topic has been locked by an administrator and is no longer open for commenting.



0コメント

  • 1000 / 1000