VisualStudioで生成したデータセットについて

田中 政人 0 Reputation points
2023-09-07T01:37:08.56+00:00

Visual Studio 2008を使用しております。

Visual Studio 2008で「データセット」を作成し、そのデータセットにSQLServerからデータを取得した内容をセットし、そのデータセットを複数のスレッドから呼び出しているのですが、このVisual Studioで作成した「データセット」はスレッドセーフでしょうか?(共有の資源を使用している箇所はありますでしょうか)

質問の経緯は、実際上記処理を行っているのですが、一定回数呼び出しを行うと、下記のように

000000002252e390 00007ffd16a0475a System_Data_ni!System.Data.Index.AddRef()+0x7d

000000002252e420 00007ffd16d29df1 System_Data_ni!System.Data.DataTable.GetIndex(System.Data.IndexField[], System.Data.DataViewRowState, System.Data.IFilter)+0xfa

000000002252e4b0 00007ffd16d27199 System_Data_ni!System.Data.DataColumn.get_SortIndex()+0x81

000000002252e510 00007ffd16d725da System_Data_ni!System.Data.DataColumn.IsNotAllowDBNullViolated()+0x19

000000002252e590 00007ffd16d72430 System_Data_ni!System.Data.DataTable.EnableConstraints()+0x14a

000000002252e610 00007ffd16a030ba System_Data_ni!System.Data.DataTable.set_EnforceConstraints(Boolean)+0x30

とAddRefを行っており、下記の「SleepEx」でSleep状態になり、応答が返ってこなくなることがあるためです。

000000002252dec8 00007ffd45c6121a ntdll!NtDelayExecution+0xa

000000002252ded0 00007ffd1767da2d KERNELBASE!SleepEx+0xa2

000000002252df70 00007ffd1734cd2d mscorwks!EESleepEx+0x2d

000000002252dff0 00007ffd17626d98 mscorwks!Thread::UserSleep+0x71

000000002252e050 00007ffd17323380 mscorwks!alloca_probe+0x83c78

000000002252e0b0 00007ffd17874a55 mscorwks!CRWLock::StaticUpgradeToWriterLock+0xa8

000000002252e190 00007ffd16a0545d mscorwks!CRWLock::StaticDoUpgradeToWriterLockPublic+0x135

000000002252e390 00007ffd16a0475a System_Data_ni!System.Data.Index.AddRef()+0x7d

000000002252e420 00007ffd16d29df1 System_Data_ni!System.Data.DataTable.GetIndex(System.Data.IndexField[], System.Data.DataViewRowState, System.Data.IFilter)+0xfa

000000002252e4b0 00007ffd16d27199 System_Data_ni!System.Data.DataColumn.get_SortIndex()+0x81

000000002252e510 00007ffd16d725da System_Data_ni!System.Data.DataColumn.IsNotAllowDBNullViolated()+0x19

000000002252e590 00007ffd16d72430 System_Data_ni!System.Data.DataTable.EnableConstraints()+0x14a

000000002252e610 00007ffd16a030ba System_Data_ni!System.Data.DataTable.set_EnforceConstraints(Boolean)+0x30

000000002252e650 00007ffd169feda9 System_Data_ni!System.Data.DataTable.EndLoadData()+0xda

000000002252e6a0 00007ffd16def741 System_Data_ni!System.Data.Common.DataAdapter.FillFromReader(System.Data.DataSet, System.Data.DataTable, System.String, System.Data.ProviderBase.DataReaderContainer, Int32, Int32, System.Data.DataColumn, System.Object)+0x149

000000002252e770 00007ffd169ffc9c System_Data_ni!System.Data.Common.DataAdapter.Fill(System.Data.DataTable[], System.Data.IDataReader, Int32, Int32)+0x2d1

000000002252e840 00007ffd16dfae03 System_Data_ni!System.Data.Common.DbDataAdapter.FillInternal(System.Data.DataSet, System.Data.DataTable[], Int32, Int32, System.String, System.Data.IDbCommand, System.Data.CommandBehavior)+0x10c

000000002252e900 00007ffd16dfaab5 System_Data_ni!System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable[], Int32, Int32, System.Data.IDbCommand, System.Data.CommandBehavior)+0x243

000000002252e9b0 00007ffcb7bceed2 System_Data_ni!System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)+0xb5

お手数ですがよろしくお願いします

Developer technologies Visual Studio Other
{count} votes

1 answer

Sort by: Most helpful
  1. 田中 政人 0 Reputation points
    2023-09-14T08:38:07.4866667+00:00

    Hello @Tianyu Sun-MSFT.

    1.What kind of project and programming language are you using?

    ⇒This is a C# project and will be a server-side program.

    2.Could you share us some code snippets or detailed steps to reproduce this issue?

    ⇒①Create an xsd format TableAdapter.

     ②Instantiate the DataTable created in ① as shown below.(Instantiate each from about 200 threads)

      var getData = new TblFormat.XXXDataTable();

     ③When all threads in ② are finished, another process starts again, and ② is repeated.

    Does that answer your question?

      

     

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.