Unhandled System.NotImplementedException with no source available?

Danny Johnson picture Danny Johnson · Jan 23, 2013 · Viewed 7.5k times · Source

I am not sure if anyone has encountered this problem.

I am developing a C# Windows Phone 8 app in VS 2012.

I have lately been getting unhandled exceptions of type System.NotImplementedException.

This is despite the fact that all of my code is surrounded in try/catch blocks, and there are no method stubs that throw a notimplementedexception.

In the output is:

A first chance exception of the type 'System.NotImplementedException' occurred in MyAppName.DLL

An exception of type 'System.NotImplementedException' occurred in MyAppName.DLL and wasn't handled before a managed/native boundary

If I hit "continue" to continue debugging, I get an error message pop up dialog in VS:

An unhandled exception of type 'System.NotImplementedException' occurred in System.Windows.ni.dll

If I choose "Break" here, the stack trace that opens says "No Source Available; The call stack contains only external code. This thread is stopped with only external code frames on the call stack. etc. etc."

This is the code highlighted after the app crashes:

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

Edit: This is the stack:

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]

Answer

Danny Johnson picture Danny Johnson · Jan 24, 2013

For anyone with a similar problem, I found the apparent cause.

I had ported some code involving file input/output from a Win8 app for Surface, and, in one of the lines, neglected to change

StorageFolder storageFolder = KnownFolders.DocumentsLibrary;

to its corresponding

IsolatedStorageFile storageFolder = IsolatedStorageFile.GetUserStoreForApplication();

Somehow this was not caught in the try/catch block, but when I fixed it, the uncaught notimplementedexception no longer occurred.