在 Silverlight 中调试竞争条件的技术

发布于 2024-09-08 00:20:46 字数 692 浏览 2 评论 0原文

我遇到了我认为的竞争条件。我必须有哪些选项来调试它?

更多详情: 我有一个使用 Telerik 网格的 Silverlight 应用程序。用户可以使用附加到网格的列选择器来自定义列。在通过代码创建可能列的列表的特定情况下,当我打开列选择器并关闭它时,网格中的数据(所有行)消失!

我看到的症状让我相信这是一种竞争条件: - 如果我在columnchooser.close行放置一个断点,并且当断点被击中时,只需继续,错误就不可见(所有网格行仍然可见) - 如果我在columnchooser.close之前的代码中放置Thread.Sleep(1000),则该错误再次消失 - 如果我在调试时保持 Visual Studio 中的“线程”窗口打开,我会看到一个线程在“线程”窗口中瞬间出现并消失,就像我在 columnchooser.close 处击中断点一样

,我尝试了以下操作来找出哪些线程是在那个时间点运行 - 但没有喜悦:

  1. System.Diagnostics.Process 在 Silverlight 中不可用,因此我无法执行 System.Diagnostics.Process.Threads 来获取以编程方式运行的线程列表。
  2. 我尝试使用“命中时”运行 Macros.Samples.VSDebugger.DumpStacks 来设置断点,但我无法弄清楚它将所有堆栈跟踪转储到哪里。

关于如何调试此问题有任何帮助或想法吗?

I've hit against what I think is a race condition. What options do I have to debug it?

More details:
I have a Silverlight application which uses Telerik grid. The columns can be customised by the user by using a column chooser attached to the grid. In a particular case where the list of possible columns are created via the code, when I open the column chooser and close it, the data in the grid (all the rows) disappear!

Symptoms that I see which lead me to believe it is a race condition:
- If I put a break point at the columnchooser.close line, and when the break point is hit, just continue, the bug is not visible (all the gird rows remain visible)
- If I put a Thread.Sleep(1000) in the code just before columnchooser.close, again the bug disappears
- If I keep the "Threads" window in Visual Studio open while debugging, I see a thread momentarily appear and disappear in the Threads window just as I hit the breakpoint at columnchooser.close

So, I tried the following to figure out which threads are running at that point in time - but no joy:

  1. System.Diagnostics.Process is not available in Silverlight, so I can't do System.Diagnostics.Process.Threads to get a list of the threads running programmatically.
  2. I tried a break point with a "When hit" run Macros.Samples.VSDebugger.DumpStacks, but I couldn't figure out where it was dumping all the stack traces to.

Any help or ideas on what I can do to debug this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一口甜 2024-09-15 00:20:46

如果没有代码,这必然是模糊的,但是您是否考虑过在列甚至网格本身上加一个

我不确定这实际上是如何工作的,但如果(正如您所暗示的)问题是由于列选择器和列创建代码试图同时访问网格那么这可能会解决它。

Without the code this is necessarily vague, but have you looked into putting a lock on the columns or even the grid itself.

I'm not sure how this would actually work, but if (as you imply) the problem is due to the column chooser and the column creation code trying to access the grid at the same time then this might solve it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文