DevExpress DisableThreadingProblemsDetection

Published Jan 23, 2009 | Updated Oct 21, 2022 | 0 comments

DevExpress 를 8.1.6 을 쓰다가 전체적으로 8.3.3 으로 업그레이드 했다…

리빌드 할땐 문제없다… but… 런타임에 에러가 생긴다… 머지??

처음엔 내가 Catch 안한 오류가 있나 해서 소스를 다시 한번 살펴봤다… 근데.. 소스는 바뀐게 없는데…

이상하다 그래서 자세히 살펴보니 Cross Thread… 얼레.. 분명히 왠만한건 InvokeRequired 체크해서 다 되어있는데…. 물론 이 부분도 소스를 수정하지 않았기 때문에 이전에 없던 문제인데… 말이 안된다…

그렇다고 지금 당장 gridcontrol 함수에 일일이 Invoke 형태로 변경하기도 그렇고….

그래서 DevExpress 사이트에서 해결 방법을 찾아보기로 했다

Url : http://www.devexpress.com/Support/Center/KB/p/AK2981.aspx
How to avoid the ArgumentOutOfRangeException exception when updating the Grid’s data source within a background thread
Article ID:	AK2981
Product Group:	.NET
Product:	XtraGrid Suite	
Version(s):	3, 6.x
Updated:	14 12 2006
Description
I have a data table connected to a GridControl that I’m modifying within different threads, and the Xtragrid component seems to be catching the updates automatically and trying to refresh based on the data changes. However, sometimes the application crashes with an ArgumentOutOfRangeException. How to avoid this problem?

Solution
This issue is not connected with the XtraGrid directly. Unfortunately, you can’t change the grid’s data source in a background thread since it will cause a lot of problems with synchronization. The XtraGrid may perform some operations with the underlying data source at the same time as your background thread changes it. In this case the grid may receive a Change notification later and will try to update rows from the data source which will cause the mentioned problem. This problem may occur in a lot of cases. For example, when a user edits data, groups it or the XtraGrid tries to recalculate the summaries. The only solution to this problem is to change the Grid’s DataSource reference within a background thread (NOTE: You will need to implement it using the Invoke method). Said differently, within a background thread you should work with a local copy of the DataSource and pass its clone to the Grid’s DataSource when necessary. In the attachment you will find a sample project which demonstrates this approach.

요약하자면… XtraGrid 와 바인딩해서 사용하는 경우.. background thread 로 처리를 해라???

거기다 샘플까지 있으니… 볼려다가… 그냥 다시 다른걸루 찾아보니..

Url : http://www.devexpress.com/Support/Center/KB/p/AK2981.aspx
DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true 

저 프로퍼티가 obsolete 라고 하지만 현재는… 사용하면 된다고 하네… 다행이다.. 가장 간단하군…

그래서 두번째 껄로 적용. 실제 해보니 가장 간단하면서도 잘 돌아간다… 임시방편일까?
obsolete 라서 좀 그렇긴 하지만.. 일단 이렇게 하니 관련 에러가 모두 사라졌다.

XtraGrid 는 내부적으로 Grid 와 DataSource 와의 동기와 처리를 한다고 되어있는데 그래서 인지 위 프로퍼티를 적용하기 전까지는 DevExpress.Data 에서 에러가 발생하고… 막 이카고….
스타일이 웬만하면 Catch 를 넣어주는걸 선호하는 지라…

아 참!! 이 함수를 DevExpress 에서는 Main 넣는 샘플로 설명이 되어있는데…

Grid 를 쓰는 부분이 공용 컴퍼넌트라서 처음에서 Main 넣어서 사용하다가 혹시나 해서 걍 해당 컴퍼넌트 생성자에 넣어서 사용해 보니.. 잘 돌아간다…

일일이 저 컴퍼넌트 쓰는 App Main 일일이 넣기 귀찮으니… 컴퍼넌트 자체에 박아놓고 쓰지머..

TAG INFORMATION

Learn more on this topic

Related Blog Posts

Blazor 에서 이동 가능한 div 구현(모바일 지원)

Blazor 에서 이동 가능한 div 구현(모바일 지원)

blazor 에서 div 엘리먼트를 드래그해서 이동할 수 있는 기능을 javascript 가 아닌 c# 코드로 구현해 보겠습니다. 또한, 데스크탑 브라우저 뿐만 아니라 모바일 디바이스도 적용 가능하게 수정합니다.

read more

Join in the conversation

Leave a Comment

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

무료 온라인 전광판

전광판

텍스트를 입력하고 텍스트 효과 및 배경효과 를 변경해서 전체화면으로 표시할 수 있는 전광판 용도로 사용하실 수 있습니다. 각종 스포츠 및 공연 관람시 응원 용도로 사용이 가능합니다.

Carousel

여러개의 슬라이드를 추가하여 프레젠테이션 및 이미지 슬라이드 용도로 사용하실 수 있습니다. 브라우저가 포함된 IT 기기로 큰 모니터에 연결하여 매장 내 공지사항 및 메뉴소개를 이미지로 표시할 수 있습니다.

Pin It on Pinterest

Shares
Share This

Share This

Share this post with your friends!

Shares