看来随机崩溃与VB.NET和COM Interop [英] Seemingly random crashes with VB.NET and COM Interop

查看:192
本文介绍了看来随机崩溃与VB.NET和COM Interop的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在VB 6中重写一个全新的VB.NET应用程序。



应用程序在终端服务下运行,大量使用COM。 p>

由于某种原因,应用程序有随机的奇怪 -




  • 随机访问违例

  • 随机缓冲区溢出错误(相同)

  • 随机错误一般情况下 - 随机错误(一般情况下) - 错误(与WinDbg异常分析指向DLL类似comdlg32.dll,mscorwks)例如Form.Load中的这一行有时会抛出 - Me.Icon = Resources.MyIcon



我已经遵循了关于资源,垃圾收集,处理模式等等...它似乎没有做任何好。



我认为有硬件问题。这在终端服务下的Win2k3虚拟机上运行。基本服务器操作系统是Win2k3与64 GB RAM。服务器有许多虚拟机,每个都运行自己的东西(Exchange等)。



有硬件问题,或者.NET环境不容易



如果硬件以某种方式进行了验证(完全不同的故事),应用程序继续运行,这将是一条可行的路线(重写更接近金属)?



我不是虚拟机的大粉丝,并怀疑它们的完整性。 (特别是在巨大的服务器上。)



编辑 - 感谢所有回复。问题最终是一个单一的.NET .DLL在我的应用程序,没有针对x86代码。 COM对象都是32位,操作系统是64位,因此我的.NET应用程序需要定位到32位。 (这解释了为什么我的示例VB6应用程序总是工作,而不是我真的想要走这条路线。)

解决方案

安装PDB文件并使用调试诊断工具1.1,用于监控您的应用程序,识别是否发生泄漏。



查看这个分析COM对象注册表干扰的好工具


I'm thinking of rewriting a brand new VB.NET application in VB 6.

The application runs under terminal services and makes heavy use of COM.

For some reason, there is random weirdness with the application -

  • Random Access Violation errors (WinDbg exception analysis points into dll's like comdlg32.dll, mscorwks)
  • Random Buffer Overflow errors (same)
  • Random errors in general - for example this line in Form.Load sometimes throws - Me.Icon = Resources.MyIcon

I have followed all possible advice concerning resources, garbage collection, disposal patterns, etc... It just doesn't seem to do any good.

I'm thinking there is hardware problems. This runs on a Win2k3 virtual machine under terminal services. The base server OS is Win2k3 with 64 GB RAM. The server has many virtual machines each running it's own "stuff" (Exchange, etc..).

Either there's hardware problems, or the .NET environment is not as easy to program against as one may think.

If the hardware were somehow verified (a entirely different story) and the application continued to behave as such would it be a feasible route to take (rewrite closer to the metal)?

I'm not a big fan of virtual machines and doubt their integrity. (Especially on huge servers.)

Edit - Thanks to all for the responses. The issue turned out to be a single .NET .DLL in my application that was not being targeted to x86 code. The COM objects are all 32 bit, the OS is 64 bit, thus my .NET application needs to be targetted to 32 bit. (This explains why my sample VB6 apps always worked. Not that I really wanted to go that route anyway.)

解决方案

Install PDB files and use "Debug Diagnostics Tool 1.1" for monitoring you app, for identify were leak occurs.

View this too "Good tools for analysing COM object registry interference?"

这篇关于看来随机崩溃与VB.NET和COM Interop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆