amibar / SmartThreadPool

A .NET Thread Pool fully implemented in C# with many features
http://www.codeproject.com/Articles/7933/Smart-Thread-Pool
Microsoft Public License
507 stars 182 forks source link

use SmartThreadPool app crashed #21

Closed ghost closed 4 years ago

ghost commented 4 years ago

problem: 问题签名: 问题事件名称: BEX64 应用程序名: Run.exe 应用程序版本: 2.0.0.0 应用程序时间戳: 5d6dfe32 故障模块名称: StackHash_b4ee 故障模块版本: 0.0.0.0 故障模块时间戳: 00000000 异常偏移: 000007fe00000000 异常代码: c0000005 异常数据: 0000000000000008 OS 版本: 6.1.7601.2.1.0.274.10 区域设置 ID: 2052 其他信息 1: b4ee 其他信息 2: b4ee5de6a2322745523997a782b35692 其他信息 3: 277e 其他信息 4: 277e19c30fbd5f6bb531ec9e027c37c3

program info: // 全局类型: // 入口点: run.Main // 架构: x64 // 运行库: .NET Framework 4.5.1 // 时间戳: 5DAD0D73 (2019/10/21 1:44:19)

SmartThreadPool. // SmartThreadPool.dll

// 全局类型: // 架构: AnyCPU (64位优先) // 运行库: .NET Framework 4.5 // 时间戳: <未知> (83155524)

what can i do to sovle this problem thankyou

ghost commented 4 years ago

windows server 2008 r2 sp1 memery: 8G

amibar commented 4 years ago

Hi, I need at least a call stack of the relevant crash to understand what happened. If you can please reconstruct the issue in code and add it here so I can take a look into it.

Ami

amibar commented 4 years ago

Hi,

It looks like you are accessing a UI control (this.listView3) from a thread of the SmartThreadPool. Windows only allows you to access the UI control from the UI thread, otherwise you get an exception something like: System.InvalidOperationException: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. that will crash the application if not handled.

If you are in WinForms project check InvokeRequired and then use BeginInvoke, see https://stackoverflow.com/questions/39513650/accessing-ui-from-outside-thread-in-winforms

Ami

amibar commented 4 years ago

Don't disable the check, just work with the UI correctly. See the link I sent earlier.

ghost commented 4 years ago

ok i'll try the Delegates . all update UI Must used the Delegates??? my soft has windows forms such as label 。is this also used Delegates To update UI??