Certain applications in windows may lock the Windows clipboard for extended periods of time. I have noticed grid.PerformAction(ToggleRowSel) will throw an exception if this clipboard is locked. This only seems to occur if DisplayLayout.Override.AllowMultiCellOperations includes AllowMultiCellOperation.Paste. If you set AllowMultiCellOperations = AllowMultiCellOperation.Default this will not occur.
If you look at the exception stack trace of the PerformAction, it is calling CurrentState which calls some method that checks the clipboard which inturn throw an exception if the Clipboard is locked. You would assume PerformAction does't nesscarily need any external exception handling everytime it's called because it returns a boolean, but after looking though the Grid code it seems there is no exception handling in any of these methods in the grid stack trace. Just wanted to get Infragistics' take on this....?
Attached is a project that demos this.
See the exception:
An exception definitely shouldn't be thrown just for this, so you should submit this to Developer Support so that it can be fixed and you can be notified when the fix is released.
-Matt
Thanks for the response. I have submitted this as an issue.
As a quick fix I have wrapped all calls to grid.PerformAction() in try/catch (in another method). This will work but looking at the call stack the CurrentState method will exersize the problem as well. There are probably quite a few places in the Grid code that call CurrentState, I would hate to have to wrapp all calls to the grid in a try/catch just because other applications might be locking the Windows clipboard.
If you suspect that this will happen often in your environment, then you could request that your case be escalated. I'm not really sure if there's any other workaround (given the call stack it doesn't really look like it), but I think that copy/paste functionality has been in the grid for a while and it seems that this hasn't come up before if the issue hasn't been addressed, so if you're dealing with a hypothetical situation, you may be ok with your fix for the moment.
Is it possible to know whether or not this has been fixed, and if so in what version? I believe we may hitting this.
Chris
I checked the case in the infragistics site: CAS-11394-JG8CXL
It says the item has been closed, and I think I remember an email a while back saying it was fixed, but I couldn't find the email - so I"m not certain.You could try my sample project against the latest version. It has the proper api calls to simulate the clipboard lock situation which in that version of Infragistics an exception would be thrown on toggle row select.
Good luck.
The related bug number to this was TFS10936, whose fix should be in the latest service release of 8.1 and higher. I also re-tested that the attached sample works correctly.
Ok - I shall. Thankyou.
We are in the process of upgrading our app to the 2009.1 release so I shall test it all then.
Thanks again.