【发布时间】:2015-03-27 09:53:16
【问题描述】:
我创建了一个 C# ASP.NET 方法,它只接受一个包含 JSON 的字符串属性,两者都在同一个类中。我的问题是,每当我键入 .Deserialize 方法(注释行)时,Visual Studio 2013 就会崩溃,并在事件日志中显示“未处理的异常”。
public object JSONAsObject()
{
object obj = new object();
JavaScriptSerializer js = new JavaScriptSerializer();
// obj = js.Deserialize<object>(this._json);
return obj;
}
如果我在 cmets 中编写该行(如上)然后删除 cmets 没有问题,所以问题似乎与 Intellisense 或我编写代码的方式有关 - 有人有什么想法吗?
崩溃日志
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentNullException
Stack:
at System.Text.RegularExpressions.Regex.Escape(System.String)
at Microsoft.OneCode.Utilities.UserControl.CodeSnippetsTextBox.UpdateRegex()
at Microsoft.OneCode.Utilities.UserControl.CodeSnippetsTextBox.OnMyWorkCollectionChanged(System.Object, System.Collections.Specialized.NotifyCollectionChangedEventArgs)
at System.Collections.ObjectModel.ObservableCollection`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs)
at System.Collections.ObjectModel.ObservableCollection`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InsertItem(Int32, System.__Canon)
at System.Collections.ObjectModel.Collection`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Add(System.__Canon)
at Microsoft.OneCode.IntellisensePresenter.ViewModel.IntellisenseViewModel.UpdateCodeSnippets(System.Collections.Generic.IEnumerable`1<Microsoft.OneCode.DataModel.CodeSearchResult>)
at Microsoft.OneCode.IntellisensePresenter.ViewModel.IntellisenseViewModel+<>c__DisplayClass5.<SearchCode>b__2()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
如果这需要进入超级用户,请告诉我。
编辑 1: 只是为了确认这个问题发生在开发过程中,而不是在运行时。输入代码时 VS 崩溃。
编辑 2: 此问题仅发生在此特定行中。我正在使用的系统非常庞大,我以前从未见过这个问题。
编辑 3: 一个全新项目中的相同问题 - 可能是 VS 2013 中的错误,但我不知道是什么首先引发了异常。
【问题讨论】:
-
键入其他关键字时是否同样的问题?
-
没有@utility - 不,它只是这一行。我创建了没有问题的实例“js”。我在 VS 2013 中编写了很多代码,这是第一次发生这种情况。再次,很抱歉没有在上面说清楚。
-
如果在另一个项目中打开并重新输入同样的问题?
-
你在VS中安装了哪些扩展?尝试禁用所有扩展,看看错误是否仍然存在。
-
@Jehof - 禁用所有扩展,然后一一启用,结果是 Bing 开发人员助手导致了问题。我看了有一个没有自动安装这个扩展的更新,我更新了它,它现在工作得很好。感谢您提出这个建议!
标签: c# .net visual-studio-2013 javascriptserializer