上周我关闭了正在使用的VS 2012(11.0)项目,今天我无法加载Windows表单设计器。相反,我收到以下消息:“在加载设计师之前防止可能的数据丢失,必须解决以下错误:路径中有非法字符。”没有忽略该消息的选项。我仍然可以运行我的代码,它也能正常工作。请准备好一个冗长的调用堆栈:
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.VisualStudio.Platform.VsAppDomainManager.d__1.MoveNext()
at Microsoft.VisualStudio.Platform.VsAppDomainManager.InnerResolveHandler(String name)
at Microsoft.VisualStudio.Platform.VsAppDomainManager.ResolveHandler(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.GetType(String typeName)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) )
很遗憾,Visual Studio没有给我更多的细节(我甚至不知道它指的是哪个“路径”),但我可以补充一些信息:
In my Settings.settings I have a string
logFileDir
that points to a log file directory. The path is currently valid and when I run my program it correctly updates the log file.The form load method is simple and as follows:
if (Properties.Settings.Default.logFileDir != null) { _logFileDir = Properties.Settings.Default.logFileDir; PopulateLstDirectory(); } else { _logFileDir = null; }
The call stack grows sometimes when I run the code but the new lines appear to be duplicates of existing ones that I pasted above.
- I have tried cleaning & rebuilding my solution and project, as well as restarting VS multiple times.
- I don't have any 3rd party controls in the project.
The 2nd highest line of the call stack says something about Path.Combine - the only time I call that function is in the Click() method of some button on my form:
string pathString = Path.Combine(_logFileDir, logFileName);