【发布时间】:2012-03-08 02:12:03
【问题描述】:
在编辑 XAML 文件时,我注意到以下错误:
System.ObjectDisposedException occurred
Message=Cannot access a disposed object.
Object name: 'FileCodeModel'.
为了调试它,我运行了另一个 Visual Studios 实例并将“调试-> 附加到进程”到显示异常的 Visual Studio 实例。
我能够在附加到进程的新实例中捕获异常。我发现了以下异常:
System.ObjectDisposedException occurred
Message=Cannot access a disposed object.
Object name: 'FileCodeModel'.
Source=Microsoft.VisualStudio.CSharp.Services.Language
ObjectName=FileCodeModel
StackTrace:
at Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CFileCodeModel.GetCompilation(Boolean fBlockForParses)
at Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CPartialTypeCollection.EnumerateParts()
at Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CPartialTypeCollection.get_Count()
at Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CSlowSnapshot..ctor(CodeElements collection)
at Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CPartialTypeCollection.CreateSnapshot()
at Microsoft.VisualStudio.CSharp.Services.Language.CodeModel.CCollectionBase.GetEnumerator()
at EnvDTE.CodeElements.GetEnumerator()
at MS.Internal.VSSymbols.SymbolProvider.GetProperties(String fullName, Boolean isTypeDefinition, Boolean useCodeModel)
at Microsoft.Xaml.Symbols.IXamlSymbols.GetProperties(String typeName, Boolean isTypeDefinition, Boolean useCodeModel)
at MS.Internal.Design.Markup.HostedType.BuildProperties(Boolean useCodeModel)
InnerException:
任何人都曾在您的 XAML 中遇到过此异常,您将如何修复它。
【问题讨论】:
-
澄清一下,这是 Visual Studio 中的错误,而不是您的代码中的错误?
-
您能否提供发生这种情况的 XAML?
-
对.. 它发生在 VS2010 中。这会导致 XAML 文件编辑速度变慢,并且 VS 有时会变得无响应。双击异常只会导致文件的顶部,没有别的。
-
发布到 connect.microsoft.com
-
现在发生在我身上。看起来“FileCodeModel”用于 IDE 中使用的 XAML 语法突出显示/文件结构信息。
标签: wpf visual-studio-2010 debugging xaml exception