NullReferenceException异常,不具有堆栈跟踪......哪里开始呢? [英] NullReferenceException, no stack trace... where to start?

查看:160
本文介绍了NullReferenceException异常,不具有堆栈跟踪......哪里开始呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF音频应用程序。

I have a WPF audio application.

偶尔(甚至在调试器)我看到一个的NullReferenceException 携带它没有堆栈跟踪信息。

Occasionally (and even in the debugger) I'm seeing a NullReferenceException which carries no stack trace information with it.

如何才能开始调试这样的问题?

How can one start debugging such an issue?

一些背景:

我是P /调用功能 WINMM.DLL 涉及登记的callback 打电话时 waveOutOpen

I'm P/Invoking functions in WinMM.dll which involves registering a callback when calling waveOutOpen

    [DllImport("winmm.dll")]
    public static extern MmResult waveOutOpen(out IntPtr phwo, IntPtr uDeviceID, WaveFmt pwfx, WaveCallbk dwCallback, IntPtr dwInstance, int fdwOpen);

这已被证明很难获得稳定的,尤其是在那里我所说的点 waveOutClose ,并立即拨打 waveOutOpen 再次(通常是改变输出格式)。

This has proved difficult to get stable, especially at the point where I call waveOutClose, and immediately call waveOutOpen again (usually to change the output format).

我怀疑问题可能与我一直在上面(虽然这么少knowlege,我可能是完全脱靶)描述的呼叫。

I suspect that the problem may be related to the calls I've been describing above (although on so little knowlege, I could be completely off-target).

再现这个问题目前正在证明难以捉摸,虽然我可以提供一个构建于谁是相当一致发现这个问题的用户。我可能会尝试加快所导致的问题,其中在调试器重现问题更是一个确定性的点的操作。

Reproducing the problem is currently proving elusive, although I can supply a build to a user who is fairly consistently seeing this problem. I might try to speed up the operations that are causing the problem to the point where reproducing the problem in the debugger is more of a certainty.

至于调试器,我还没有与任何设置(包括启用非托管代码调试)或任何调试的修修补补 - >例外... 设置。说实话,我很无能上这里提供什么,所以任何提示是值得欢迎的。

With regards to the debugger, I haven't tinkered with any of the settings (including Enable unmanaged code debugging) or any of the Debug -> Exceptions... settings. To be honest, I'm fairly clueless about what's on offer here, so any hints are welcome.

如何可能异常不会有堆栈跟踪?你以前见过吗?救命啊!

How might an exception not have a stack trace? Have you seen this before? Help!

推荐答案

您可以在调试器中做的最有用的东西是指示它在第一次机会异常打破(调试 - >例外):

The most helpful thing you can do in the debugger is instruct it to break on a first-chance exception (Debug -> Exceptions):

这将导致在精确的点闯入调试器的NullReferenceException 被抛出,这几乎是最好的你所能希望的同时调试。

This will cause a break into the debugger at the exact point a NullReferenceException is thrown, which is pretty much the best you can ever hope for while debugging.

这篇关于NullReferenceException异常,不具有堆栈跟踪......哪里开始呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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