c# - 没有可用源的未处理的 System.NotImplementedException?

标签 c# visual-studio-2012 windows-phone-8 notimplementedexception

不知道有没有人遇到过这个问题。

我正在 VS 2012 中开发 C# Windows Phone 8 应用。

我最近遇到了 System.NotImplementedException 类型的未处理异常。

尽管我的所有代码都包含在 try/catch block 中,并且没有抛出 notimplementedexception 的方法 stub 。

在输出中是:

MyAppName.DLL 中发生类型为“System.NotImplementedException”的第一次机会异常

MyAppName.DLL 中发生“System.NotImplementedException”类型的异常,并且未在托管/ native 边界之前处理

如果我点击“继续”继续调试,我会在 VS 中收到一条错误消息弹出对话框:

System.Windows.ni.dll 中发生类型为“System.NotImplementedException”的未处理异常

如果我在这里选择“中断”,打开的堆栈跟踪显示“没有可用的源;调用堆栈仅包含外部代码。此线程停止时调用堆栈上只有外部代码帧。 等等等等。”

这是应用程序崩溃后突出显示的代码:

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    {
        if (Debugger.IsAttached)
        {
            // An unhandled exception has occurred; break into the debugger
            Debugger.Break();
        }
    }

编辑:这是堆栈:

Call stack with external code
System.Windows.ni.dll!MS.Internal.JoltHelper.OnUnhandledException(object sender, System.UnhandledExceptionEventArgs args)
mscorlib.ni.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ThrowAsync.AnonymousMethod_1(object state)
mscorlib.ni.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state)
mscorlib.ni.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.QueueUserWorkItemCallback..System.Threading.|ThreadPoolWorkItem.ExecuteWorkItem()
mscorlib.ni.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
mscorlib.ni.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
[Native to Managed Transition]

最佳答案

对于有类似问题的任何人,我找到了明显的原因。

我从 Surface 的 Win8 应用程序移植了一些涉及文件输入/输出的代码,并且在其中一行中,忽略了更改

StorageFolder storageFolder = KnownFolders.DocumentsLibrary;

对应的

IsolatedStorageFile storageFolder = IsolatedStorageFile.GetUserStoreForApplication();

不知何故,这并没有在 try/catch block 中捕获,但是当我修复它时,未捕获的 notimplementedexception 不再发生。

关于c# - 没有可用源的未处理的 System.NotImplementedException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14488867/

相关文章:

cordova - 为 wp8 cordova 应用程序实现后退按钮功能

windows-phone-8 - 适用于 Windows Phone 8 的企业应用程序分发 - 是否需要旁载许可证?

c# - 在 WIA 2.0 中扫描时设置页面大小

c++ - Visual Studio 2012 试图缩进代码块更改代码

c# - 无法访问 asp :TextBox tag from the C# file : the name 'txtUsername' does not exist in the current context

sql-server - 模式比较检测相同存储过程的差异

c# - 是否可以在不使用 KeyContainerName 的情况下签署 xml 文档?

c# - 表单例份验证-密码恢复-我宁愿用户在网络上重置它而不发送电子邮件

c# - 是否有用于排序方法的 Visual Studio 2010 扩展?

c# - 如何在不使用等待的情况下在系统托盘中显示进度指示器几秒钟 [Windows Phone 8]