Telerik UI for Winforms (2023.40) - RadGanttView - Collection was modified; enumeration operation may not execute.

2 Answers 46 Views
GanttView
João
Top achievements
Rank 1
Iron
Iron
Iron
João asked on 20 Jul 2023, 03:48 PM

Helo, i'll go straight to the point

 

************** ERROR START **************

See the end of this message for details on invoking 

just-in-time (JIT) debugging instead of this dialog box.

 

************** Exception Text **************

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

  at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()

  at Telerik.WinControls.ComponentInputBehavior.ElementUnderMouseMonitorTimer_Tick(Object sender, EventArgs e)

  at System.Windows.Forms.Timer.OnTick(EventArgs e)

  at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** ERROR END **************

 

I get the error when i subscribe to the event 'GraphicalViewItemFormatting'.

Example: THIS-OBJECT:radGanttView1:GraphicalViewItemFormatting:Subscribe(THIS-OBJECT:radGanttView1_GraphicalViewItemFormatting).

 

I can replicate the error by moving the mouse really fast (from the text element to the graphic element over and over again). If i unsubscribe then everything works just fine. This error is faster to replicate if there's more objects in the RadGanttView in question.

 

This error doesn't seem to exist anywhere BUT in Progress. I had this problem with the "RadGridView" but i managed to go around it. Something i wasn't able to do in this object.

 

My goal is to change the items/tasks colors but aparently that isn't something that can be done OUTSIDE of an event...

 

I talked to my colleagues and the ones with years of experience said it's probably on the DLL side. They said a 'Collection' is being modified at the wrong time and it's not in my control. 

 

Does anyone know how to go around this? How I may change the items colors without using this event? Maybe a way to disable highlights and animations on the object to prevent said 'Collection' from being modified?

 

Thank you.

 

JP

 

Update1: Aparently this also happens to the 'TextViewItemFormatting' event. If i comment both subscribes everything goes perfect.

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 25 Jul 2023, 12:09 PM

Hi João,

Thank you for the provided stack trace. However, using only the provided information I can't determine why this exception occurs on your side. In general, using the GraphicalViewItemFormatting and TextViewItemFormatting events is the way to customize specific items in the text and graphic view depending on your condition. Using any other place, will not get the same result as the visual items are reused. Could it be possible to isolate this exception in a WinForms sample project? This way I can debug the exception and try to find the reason behind it.

I am asking for a WinForms project because I notice that you are using different code syntax. Looking at the way how the GraphicalViewItemFormatting event is subscribed, I am assuming that you are using OpenEdge and Developer Studio. Please note that for OpenEdge-related topics the preferred places to submit a technical question are Salesforce and the Progress Community. You can log in to these websites straight from your Progress account: https://progresslink.progress.com/supportlink.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

João
Top achievements
Rank 1
Iron
Iron
Iron
commented on 25 Jul 2023, 05:22 PM

Hi there.

I created a small program and i tried to replicate the error but i was very rarelly able to replicate it IF i was running it via text editor. If i was opening it in my company product then it's a lot easier (I think it's because it's not as fast as the running the problem solo). I managed to install and use a open source online debugger and i managed to obtain the information that you can find in the attached files.

Plus, i added the "Example.png" so you could see how's the visual (on the gantt) when I managed to replicate the error (notice several highlighted cells).

I don't know what else I can do without having the source code.... Do you guys have it on GITHUB?

 

0
Dinko | Tech Support Engineer
Telerik team
answered on 28 Jul 2023, 12:18 PM

Hello João,

Thank you for the provided details.

Looking at the provided images, the error appears in the Gdip which is more related to the OpenEdge rather than to our WinForms control. I am guessing as I am unable to reproduce it in a standalone WinForms project written in C# without an OpenEdge product. Without reproducing this behavior I can only guess what is causing it and how to overcome it. Is it possible to share the code in the GraphicalViewItemFormatting and TextViewItemFormatting event handlers? I need to check if there is some specific code that could lead to this.

The source code of the controls is not available on GitHub. If you are a licensed user, you can download the source code of our control directly from your Telerik Account. You can check the Download Product Files help article which describes the steps to navigate to the download page.

I would suggest submitting a technical question in Salesforce or Progress Community. By logging into your Progress account you can navigate to these websites. This way the corresponding OpenEdge team will check your inquiry and contact you with more information.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

João
Top achievements
Rank 1
Iron
Iron
Iron
commented on 28 Jul 2023, 01:30 PM

Hey there!

I don't have any code in my events. They are just empty methods that are being subscribed.

Got any other idea?

Another question, why is the color of the objects only possible to edit in an event? Why isn't there a property that I could update to do exacly that? Why risk losing so much in performance?

Dinko | Tech Support Engineer
Telerik team
commented on 28 Jul 2023, 01:56 PM

If you don't have any code in the events, this leads me to think that the event is subscribed to many times. Can you place a breakpoint on the subscription of the event and ensure that you are subscribing to the GraphicalViewItemFormatting and TextViewItemFormatting events only one time?

The GraphicalViewItemFormatting and TextViewItemFormatting events are the way to customize different elements in the control. Subscribing to these events won't affect the performance. I am curious why this is happening on your side. Can you double-check the above suggestion and share how it goes?

João
Top achievements
Rank 1
Iron
Iron
Iron
commented on 28 Jul 2023, 02:11 PM

I only have it subscribed once. If i try to do it more than once i get an error.  

It obviously affects performance... If i hover my mouse over the lines of a gantt (with apopintments/items/tasks) the event fires several times. How wouldn't that affect my performance? If I (or even the client) try to play around with the program it eventually gets really slow because is firing events constantly.

Dinko | Tech Support Engineer
Telerik team
commented on 01 Aug 2023, 10:39 AM

This is quite strange behavior. Subscribing to the events should not affect the performance in any way. To be sure why this is happening I will need somehow to reproduce this. Can you try to isolate this in a Developer Studio project and also share which OpenEdge version are you using? Isolating this in a standalone project will be the first step to determine what is causing this performance hit. 

I am waiting for your reply.

Tags
GanttView
Asked by
João
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or