This project is read-only.
1
Vote

DirectoryNotFoundException was unhandled error when debugging

description

System.IO.DirectoryNotFoundException was unhandled
Message=Could not find a part of the path 'C:\Users\Win7Guru\Documents\Downloads\Current%20Software\mockuptoxaml-51986\Source\MockupToXaml\bin\Debug\Templates\Window.txt'.
Source=mscorlib
StackTrace:
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at MockupToXaml.ViewModel.MappingViewModel..ctor() in C:\Users\Win7Guru\Documents\Downloads\Current Software\mockuptoxaml-51986\Source\MockupToXaml\ViewModel\MappingViewModel.cs:line 20
   at MockupToXaml.View.MappingView..ctor(String filename) in C:\Users\Win7Guru\Documents\Downloads\Current Software\mockuptoxaml-51986\Source\MockupToXaml\View\MappingView.xaml.cs:line 25
   at MockupToXaml.MainWindow.miOpenMockup_Click(Object sender, RoutedEventArgs e) in C:\Users\Win7Guru\Documents\Downloads\Current Software\mockuptoxaml-51986\Source\MockupToXaml\MainWindow.xaml.cs:line 34
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at MockupToXaml.App.Main() in C:\Users\Win7Guru\Documents\Downloads\Current Software\mockuptoxaml-51986\Source\MockupToXaml\obj\x86\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
InnerException:

 

Visual Studio version= 2010 Express
OS Name Microsoft Windows 7 Home Premium
Version 6.1.7600 Build 7600
System Model Studio 1558
System Type x64-based PC
Processor Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz, 2133 Mhz, 2 Core(s), 4 Logical Processor(s)
BIOS Version/Date Dell Inc. A04, 3/11/2010

file attachments

comments

win7guru wrote Jul 26, 2010 at 10:57 PM

The attached file is the process of steps to recreate the error, which ironically I made in Balsamiq Mockups.

Khonsort wrote Sep 24, 2010 at 1:58 PM

Hello,

I think the reason of that bug is the presence of "%20" to represent white space in path.

I've added a .Replace( "%20", " ") at the end of uri.AbsolutePath.Replace( "/", "\" ). That's work.

Meanwhile, this solution is specific to white spaces in path...

Regards

wrote Feb 13, 2013 at 11:59 PM