[DevExpress Support Team: CLONED FROM T520559: Questions about the "Entering the 'GetObjectsNonReenterant' state…" error]
Hi Dennis,
Thanks you for your response.
I've just put the application on production to see if it works fine and I see that the DataGrid does not crash on refreshing the DataGrid, which is good, but only when there are a few rows to show. when there are a lot of records it does not show the data, it shows only the empty rows. When I scroll up or down the DataGrid does not show the rows any more. After another refresh it shows again everything. It is look like that it happen randomly.
Do you have any suggestion?
Thanks
Update:
I've enabled CLR exception and disabled the "Just My Code" debugging. I get these exceptions:
1. On start:
System.InvalidOperationException occurred
Message=Reenter detected!!!
Source=DevExpress.Data.v11.2
StackTrace:
bij DevExpress.Data.Helpers.ServerModeCache.ReenterancyWatch…ctor(ServerModeCache watched)
InnerException:
2. On after start:
System.Data.SqlClient.SqlException occurred
Message: Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Additional information: Time-out is verlopen. De time-outperiode is verstreken voordat de bewerking werd voltooid of de server reageert niet.
3. on auto refresh:
DevExpress.Data.Helpers.InconsistencyDetectedException occurred
Message=Unexpected number of returned keys: 99. Expected: 98
Source=DevExpress.Data.v11.2
StackTrace:
bij DevExpress.Data.Helpers.ServerModeCache.RaiseInconsistencyDetected(String message)
InnerException:
4. On scroll up/down:
DevExpress.Data.Helpers.InconsistencyDetectedException occurred
Message=Key '173683' fetched at index 7377 does not match previously fetched key '173682' for the same index
Source=DevExpress.Data.v11.2
StackTrace:
bij DevExpress.Data.Helpers.ServerModeCache.RaiseInconsistencyDetected(String message)
InnerException:
Hi David,
Thank you for the error details. The last two errors (InconsistencyDetectedException) usually occur when the database is constantly updated by multiple users. This exception is not critical, and the Server Mode collection internally handles it. When this exception occurs, the collection drops all previously loaded data and attempts to reload the recent data from the database.
If these errors occur constantly when you scroll the view up and down, this indicates that the data retrieved from the database is inconsistent. This can be caused by different factors. For example, scrolling will not work with similar errors if the Key property used to identify rows is linked to a column with dynamically generated values (something like SELECT NEWID() AS ID). Of course, this is not the only reason.
To research this issue further, it is necessary to obtain SQL logs (if you are using XPO, you can obtain the logs using the approach described here: How to log the SQL queries made by XPO) and analyze them. Note queries executed multiple times without an obvious reason and the result they return. This information may shed some light on the issue. Please do not hesitate to share the result of your research, as we can give advice or share our ideas based on the new information.
Hello Uriah,
I've tried to visualize the logging, this is the result:
01.06.17 16:54:09.287 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{31/05/2017 16:53:39},{1/06/2017 16:53:39}
01.06.17 16:54:09.367 Result: rowcount = 1, total = 4, SubQuery{Count,) = 4
01.06.17 16:54:09.369 Executing sql 'select top 201 N0."Rac_ID" from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)) order by N0."Rac_ID" asc' with parameters {204},{31/05/2017 16:53:39},{1/06/2017 16:53:39}
01.06.17 16:54:09.415 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
01.06.17 16:54:09.418 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{31/05/2017 16:53:39},{1/06/2017 16:53:39}
01.06.17 16:54:09.439 Result: rowcount = 1, total = 4, SubQuery{Count,) = 4
01.06.17 16:54:09.441 Executing sql 'select top 201 N0."Rac_ID" from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)) order by N0."Rac_ID" asc' with parameters {204},{31/05/2017 16:53:39},{1/06/2017 16:53:39}
01.06.17 16:54:09.484 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
01.06.17 16:54:09.487 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{31/05/2017 16:53:39},{1/06/2017 16:53:39}
01.06.17 16:54:09.508 Result: rowcount = 1, total = 4, SubQuery{Count,) = 4
01.06.17 16:54:09.509 Executing sql 'select top 201 N0."Rac_ID" from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)) order by N0."Rac_ID" asc' with parameters {204},{31/05/2017 16:53:39},{1/06/2017 16:53:39}
01.06.17 16:54:09.552 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
01.06.17 16:54:09.572 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:09.589 Result: rowcount = 1, total = 4, SubQuery{Count,) = 4
01.06.17 16:54:09.592 Executing sql 'select top 201 N0."Rac_ID" from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)) order by N0."Rac_ID" asc' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:09.667 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
01.06.17 16:54:09.672 Executing sql 'select N0."Rac_ID",N0."Rac_RecordNumber",N0."Rac_ControllerName",N0."Rac_ControllerID",N0."Rac_LevelNames",N0."Rac_Cardholder",N0."Rac_CardID",N0."Cag_Name",N0."Rac_CardCode",N0."Rac_LevelId",N0."Rac_LevelName",N0."Rac_LogDateTime",N0."Rac_IO",N0."Rac_Description",N0."Rac_ReaderID",N0."Rac_ReaderName",N0."Rac_Action",N0."Rac_Present",N0."Rac_CreditCounter",N0."Rac_DayCounter",N0."Rac_Active",N0."Rac_LastUpdate",N0."Rac_ModifiedBy",N0."Lev_Name",N0."Rac_LedInfo1",N0."Rac_LedInfo2",N0."Rac_LedStaffNumber" from "dbo"."VW_Reg_AccessControl2" N0 where N0."Rac_ID" in (@p0,@p1,@p2,@p3,@p4)' with parameters {184999},{185000},{185001},{185002},{185003}
01.06.17 16:54:10.021 Result: rowcount = 5, total = 1075, N0.{Rac_ID,Int64} = 40, N0.{Rac_RecordNumber,Int32} = 20, N0.{Rac_ControllerName,String} = 90, N0.{Rac_ControllerID,Int32} = 20, N0.{Rac_LevelNames,String} = 20, N0.{Rac_Cardholder,String} = 20, N0.{Rac_CardID,String} = 50, N0.{Cag_Name,String} = 30, N0.{Rac_CardCode,String} = 150, N0.{Rac_LevelId,Int64} = 40, N0.{Rac_LevelName,String} = 120, N0.{Rac_LogDateTime,DateTime} = 40, N0.{Rac_IO,String} = 40, N0.{Rac_Description,String} = 30, N0.{Rac_ReaderID,Int32} = 20, N0.{Rac_ReaderName,String} = 30, N0.{Rac_Action,String} = 30, N0.{Rac_Present,String} = 30, N0.{Rac_CreditCounter,Int32} = 20, N0.{Rac_DayCounter,Int32} = 20, N0.{Rac_Active,Boolean} = 5, N0.{Rac_LastUpdate,DateTime} = 40, N0.{Rac_ModifiedBy,Int32} = 20, N0.{Lev_Name,String} = 90, N0.{Rac_LedInfo1,String} = 20, N0.{Rac_LedInfo2,String} = 20, N0.{Rac_LedStaffNumber,String} = 20
01.06.17 16:54:10.027 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:10.142 Result: rowcount = 1, total = 4, SubQuery{Count,) = 4
01.06.17 16:54:10.144 Executing sql 'select top 201 N0."Rac_ID" from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)) order by N0."Rac_ID" asc' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:10.166 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
01.06.17 16:54:10.171 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:10.187 Result: rowcount = 1, total = 4, SubQuery{Count,) = 4
01.06.17 16:54:10.189 Executing sql 'select top 201 N0."Rac_ID" from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)) order by N0."Rac_ID" asc' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:10.209 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
01.06.17 16:54:10.228 Executing sql 'select top 201 N0."Rac_ID" from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)) order by N0."Rac_LastUpdate" desc,N0."Rac_ID" desc' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:10.417 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
01.06.17 16:54:10.419 Executing sql 'select N0."Rac_ID",N0."Rac_RecordNumber",N0."Rac_ControllerName",N0."Rac_ControllerID",N0."Rac_LevelNames",N0."Rac_Cardholder",N0."Rac_CardID",N0."Cag_Name",N0."Rac_CardCode",N0."Rac_LevelId",N0."Rac_LevelName",N0."Rac_LogDateTime",N0."Rac_IO",N0."Rac_Description",N0."Rac_ReaderID",N0."Rac_ReaderName",N0."Rac_Action",N0."Rac_Present",N0."Rac_CreditCounter",N0."Rac_DayCounter",N0."Rac_Active",N0."Rac_LastUpdate",N0."Rac_ModifiedBy",N0."Lev_Name",N0."Rac_LedInfo1",N0."Rac_LedInfo2",N0."Rac_LedStaffNumber" from "dbo"."VW_Reg_AccessControl2" N0 where N0."Rac_ID" in (@p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12,@p13,@p14,@p15)' with parameters {186672},{186671},{186670},{186669},{186668},{186667},{186666},{186665},{186664},{186663},{186662},{186661},{186660},{186659},{186658},{186657}
01.06.17 16:54:10.450 Result: rowcount = 16, total = 3440, N0.{Rac_ID,Int64} = 128, N0.{Rac_RecordNumber,Int32} = 64, N0.{Rac_ControllerName,String} = 288, N0.{Rac_ControllerID,Int32} = 64, N0.{Rac_LevelNames,String} = 64, N0.{Rac_Cardholder,String} = 64, N0.{Rac_CardID,String} = 160, N0.{Cag_Name,String} = 96, N0.{Rac_CardCode,String} = 480, N0.{Rac_LevelId,Int64} = 128, N0.{Rac_LevelName,String} = 384, N0.{Rac_LogDateTime,DateTime} = 128, N0.{Rac_IO,String} = 128, N0.{Rac_Description,String} = 96, N0.{Rac_ReaderID,Int32} = 64, N0.{Rac_ReaderName,String} = 96, N0.{Rac_Action,String} = 96, N0.{Rac_Present,String} = 96, N0.{Rac_CreditCounter,Int32} = 64, N0.{Rac_DayCounter,Int32} = 64, N0.{Rac_Active,Boolean} = 16, N0.{Rac_LastUpdate,DateTime} = 128, N0.{Rac_ModifiedBy,Int32} = 64, N0.{Lev_Name,String} = 288, N0.{Rac_LedInfo1,String} = 64, N0.{Rac_LedInfo2,String} = 64, N0.{Rac_LedStaffNumber,String} = 64
01.06.17 16:54:11.380 Executing sql 'select N0."Rac_ID",N0."Rac_RecordNumber",N0."Rac_ControllerName",N0."Rac_ControllerID",N0."Rac_LevelNames",N0."Rac_Cardholder",N0."Rac_CardID",N0."Cag_Name",N0."Rac_CardCode",N0."Rac_LevelId",N0."Rac_LevelName",N0."Rac_LogDateTime",N0."Rac_IO",N0."Rac_Description",N0."Rac_ReaderID",N0."Rac_ReaderName",N0."Rac_Action",N0."Rac_Present",N0."Rac_CreditCounter",N0."Rac_DayCounter",N0."Rac_Active",N0."Rac_LastUpdate",N0."Rac_ModifiedBy",N0."Lev_Name",N0."Rac_LedInfo1",N0."Rac_LedInfo2",N0."Rac_LedStaffNumber" from "dbo"."VW_Reg_AccessControl2" N0 where N0."Rac_ID" in (@p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12,@p13,@p14,@p15,@p16,@p17,@p18,@p19,@p20,@p21,@p22,@p23,@p24,@p25,@p26,@p27,@p28,@p29,@p30,@p31,@p32,@p33,@p34,@p35,@p36,@p37,@p38)' with parameters {186601},{186600},{186599},{186598},{186597},{186596},{186595},{186594},{186593},{186592},{186591},{186590},{186589},{186588},{186587},{186586},{186585},{186584},{186583},{186582},{186581},{186580},{186579},{186578},{186577},{186576},{186575},{186574},{186573},{186572},{186571},{186570},{186569},{186568},{186567},{186566},{186565},{186564},{186563}
01.06.17 16:54:11.416 Result: rowcount = 39, total = 8385, N0.{Rac_ID,Int64} = 312, N0.{Rac_RecordNumber,Int32} = 156, N0.{Rac_ControllerName,String} = 702, N0.{Rac_ControllerID,Int32} = 156, N0.{Rac_LevelNames,String} = 156, N0.{Rac_Cardholder,String} = 156, N0.{Rac_CardID,String} = 390, N0.{Cag_Name,String} = 234, N0.{Rac_CardCode,String} = 1170, N0.{Rac_LevelId,Int64} = 312, N0.{Rac_LevelName,String} = 936, N0.{Rac_LogDateTime,DateTime} = 312, N0.{Rac_IO,String} = 312, N0.{Rac_Description,String} = 234, N0.{Rac_ReaderID,Int32} = 156, N0.{Rac_ReaderName,String} = 234, N0.{Rac_Action,String} = 234, N0.{Rac_Present,String} = 234, N0.{Rac_CreditCounter,Int32} = 156, N0.{Rac_DayCounter,Int32} = 156, N0.{Rac_Active,Boolean} = 39, N0.{Rac_LastUpdate,DateTime} = 312, N0.{Rac_ModifiedBy,Int32} = 156, N0.{Lev_Name,String} = 702, N0.{Rac_LedInfo1,String} = 156, N0.{Rac_LedInfo2,String} = 156, N0.{Rac_LedStaffNumber,String} = 156
01.06.17 16:54:11.554 Executing sql 'select N0."Rac_ID",N0."Rac_RecordNumber",N0."Rac_ControllerName",N0."Rac_ControllerID",N0."Rac_LevelNames",N0."Rac_Cardholder",N0."Rac_CardID",N0."Cag_Name",N0."Rac_CardCode",N0."Rac_LevelId",N0."Rac_LevelName",N0."Rac_LogDateTime",N0."Rac_IO",N0."Rac_Description",N0."Rac_ReaderID",N0."Rac_ReaderName",N0."Rac_Action",N0."Rac_Present",N0."Rac_CreditCounter",N0."Rac_DayCounter",N0."Rac_Active",N0."Rac_LastUpdate",N0."Rac_ModifiedBy",N0."Lev_Name",N0."Rac_LedInfo1",N0."Rac_LedInfo2",N0."Rac_LedStaffNumber" from "dbo"."VW_Reg_AccessControl2" N0 where N0."Rac_ID" in (@p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12,@p13,@p14,@p15,@p16,@p17,@p18,@p19,@p20,@p21,@p22,@p23,@p24,@p25,@p26,@p27,@p28,@p29,@p30,@p31,@p32,@p33,@p34,@p35,@p36,@p37,@p38,@p39,@p40,@p41,@p42,@p43,@p44,@p45,@p46,@p47,@p48,@p49,@p50,@p51)' with parameters {186562},{186561},{186560},{186559},{186558},{186557},{186556},{186555},{186554},{186553},{186552},{186551},{186550},{186549},{186548},{186547},{186546},{186545},{186544},{186543},{186542},{186541},{186540},{186539},{186538},{186537},{186536},{186535},{186534},{186533},{186532},{186531},{186530},{186529},{186528},{186527},{186526},{186525},{186524},{186523},{186522},{186521},{186520},{186519},{186518},{186517},{186516},{186515},{186514},{186513},{186512},{186511}
01.06.17 16:54:11.952 Result: rowcount = 52, total = 11180, N0.{Rac_ID,Int64} = 416, N0.{Rac_RecordNumber,Int32} = 208, N0.{Rac_ControllerName,String} = 936, N0.{Rac_ControllerID,Int32} = 208, N0.{Rac_LevelNames,String} = 208, N0.{Rac_Cardholder,String} = 208, N0.{Rac_CardID,String} = 520, N0.{Cag_Name,String} = 312, N0.{Rac_CardCode,String} = 1560, N0.{Rac_LevelId,Int64} = 416, N0.{Rac_LevelName,String} = 1248, N0.{Rac_LogDateTime,DateTime} = 416, N0.{Rac_IO,String} = 416, N0.{Rac_Description,String} = 312, N0.{Rac_ReaderID,Int32} = 208, N0.{Rac_ReaderName,String} = 312, N0.{Rac_Action,String} = 312, N0.{Rac_Present,String} = 312, N0.{Rac_CreditCounter,Int32} = 208, N0.{Rac_DayCounter,Int32} = 208, N0.{Rac_Active,Boolean} = 52, N0.{Rac_LastUpdate,DateTime} = 416, N0.{Rac_ModifiedBy,Int32} = 208, N0.{Lev_Name,String} = 936, N0.{Rac_LedInfo1,String} = 208, N0.{Rac_LedInfo2,String} = 208, N0.{Rac_LedStaffNumber,String} = 208
01.06.17 16:54:11.961 Executing sql 'select resultSet.F0 from(select N0."Rac_ID" as F0, row_number() over( order by N0."Rac_LastUpdate" desc,N0."Rac_ID" desc) as 'rowNumber' from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)))resultSet where resultSet.rowNumber > 200 and resultSet.rowNumber <= 200 + 201' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
01.06.17 16:54:11.988 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608
Exception thrown: 'DevExpress.Data.Helpers.InconsistencyDetectedException' in DevExpress.Data.v11.2.dll
01.06.17 16:54:11.997 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09}
Exception thrown: 'System.InvalidOperationException' in DevExpress.Data.v11.2.dll
01.06.17 16:54:12.025 Result: rowcount = 1, total = 4, SubQuery{Count,) = 4
What I see is that I constantly get two kind of exception:
System.Data.SqlClient.SqlException occurred
Message: Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Additional information: Time-out is verlopen. De time-outperiode is verstreken voordat de bewerking werd voltooid of de server reageert niet.
DevExpress.Data.Helpers.InconsistencyDetectedException occurred
Message=Key '173683' fetched at index 7377 does not match previously fetched key '173682' for the same index
Source=DevExpress.Data.v11.2
StackTrace:
bij DevExpress.Data.Helpers.ServerModeCache.RaiseInconsistencyDetected(String message)
InnerException:
I'm working on a database that almost every seconds has new data inserted.
Hello David,
Thank you for the provided information. Currently, we don't have any precise ideas why the issue may occur. However, we missed an important exception that occurs on startup:
System.InvalidOperationException occurred
Message=Reenter detected!!!
Would you please provide us with the full call-stack of this error? For this, do the following:
The following video illustrates how to do it: https://www.screencast.com/t/KNBetxraq.
We will analyze the call-stack and let you know if it allows us to determine the cause of the problem. I look forward to your response.
Hello Sasha,
Sorry for my delayed response, I was out of office for couple of days.
The exception that I get right now is :
DevExpress.Data.Helpers.InconsistencyDetectedException occurred
Message=Key '248540' fetched at index 7800 does not match previously fetched key '248480' for the same index
Source=DevExpress.Data.v11.2
StackTrace:
bij DevExpress.Data.Helpers.ServerModeCache.RaiseInconsistencyDetected(String message)
InnerException:
Then a Grid without data when I scroll up/dwon.
You can find the the call stack in a text file.
bij DevExpress.Data.Helpers.ServerModeCache.ReenterancyWatch…ctor(ServerModeCache watched)
bij DevExpress.Data.Helpers.ServerModeCache.CreateTopGroupInfo()
Hello David,
Thank you for the provided callstack. It was very helpful. According to the callstack, the reenter exception is thrown because the WMPaint method is called while the UI thread is locked. You can see it in the following callstack lines:
DevExpress.XtraGrid.v11.2.dll!DevExpress.XtraGrid.GridControl.OnPaint(System.Windows.Forms.PaintEventArgs e = {ClipRectangle = {System.Drawing.Rectangle}}) System.Windows.Forms.dll!System.Windows.Forms.Control.PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs e, short layer) System.Windows.Forms.dll!System.Windows.Forms.Control.WmPaint(ref System.Windows.Forms.Message m) System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) DevExpress.XtraEditors.v11.2.dll!DevExpress.XtraEditors.Container.EditorContainer.WndProc(ref System.Windows.Forms.Message m = {System.Windows.Forms.Message}) DevExpress.XtraGrid.v11.2.dll!DevExpress.XtraGrid.GridControl.WndProc(ref System.Windows.Forms.Message m = {System.Windows.Forms.Message}) System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 15, System.IntPtr wparam, System.IntPtr lparam) [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.Threading.WaitHandle.WaitOne(long timeout, bool exitContext) mscorlib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout, bool exitContext) System.Data.dll!System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() System.Data.dll!System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket() System.Data.dll!System.Data.SqlClient.TdsParserStateObject.ReadBuffer() System.Data.dll!System.Data.SqlClient.TdsParserStateObject.ReadByte()
As you can see, the provider waits for a response from the server, and the WmPaint method is called, causing the Grid refresh. This is known behavior. Common ways of resolving this problem are described in the Troubleshooting - How to resolve the "Entering the 'GetObjectsNonReenterant' state…" error KB Article. Please use one of the approaches suggested in paragraph 4, i.e., either use the STASafeDataStore wrapper or mark your app with the MTAThread attribute.
As for the InconsistencyDetected exception, it indicates that the database was modified by another user. This exception is handled internally and when it occurs, XPServerCollectionSource is reloaded. According to the SQL query log provided in one of your previous comments, InvalidOperationException occurs when the second SQL query is executed:
01.06.17 16:54:11.961 Executing sql 'select resultSet.F0 from(select N0."Rac_ID" as F0, row_number() over( order by N0."Rac_LastUpdate" desc,N0."Rac_ID" desc) as 'rowNumber' from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2)))resultSet where resultSet.rowNumber > 200 and resultSet.rowNumber <= 200 + 201' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09} 01.06.17 16:54:11.988 Result: rowcount = 201, total = 1608, N0.{Rac_ID,Int64} = 1608 Exception thrown: 'DevExpress.Data.Helpers.InconsistencyDetectedException' in DevExpress.Data.v11.2.dll 01.06.17 16:54:11.997 Executing sql 'select top 1 count(*) from "dbo"."VW_Reg_AccessControl2" N0 where ((N0."Rac_LevelId" = @p0) and (N0."Rac_LogDateTime" >= @p1) and (N0."Rac_LogDateTime" <= @p2))' with parameters {204},{1/06/2017 15:54:09},{1/06/2017 16:54:09} Exception thrown: 'System.InvalidOperationException' in DevExpress.Data.v11.2.dll 01.06.17 16:54:12.025 Result: rowcount = 1, total = 4, SubQuery{Count,,) = 4
Likely, this is the same exception that is thrown when re-entrance occurs. Thus, the approach from the Troubleshooting - How to resolve the "Entering the 'GetObjectsNonReenterant' state…" error KB Article should help resolve the issue. If not, please provide us with the callstack of InvalidOperationException that occurs after the InconsistencyDetected exception. For this, reproduce the InconsistencyDetected exception and when the debugger breaks, ignore this exception and collect the callstack of the next exception.
I look forward to your results.