Designer error visual studio

Is there a good way to debug errors in the Visual Studio Designer? In our project we have tons of UserControls and many complex forms. For the complex ones, the Designer often throws various excep...

Is there a good way to debug errors in the Visual Studio Designer?

In our project we have tons of UserControls and many complex forms. For the complex ones, the Designer often throws various exceptions which doesn’t help much, and I was wondering if there’s some nice way to figure out what has gone wrong.

The language is C#, and we’re using Visual Studio 2005.

Peter Mortensen's user avatar

asked Sep 2, 2008 at 14:22

Daisuke Shimamoto's user avatar

I’ve been able to debug some control designer issues by running a second instance of VS, then from your first VS instance do a «Debug -> Attach to Process» and pick «devenv».

The first VS instance is where you’ll set your breakpoints. Use the second instance to load up the designer to cause the «designer» code to run.

answered Sep 2, 2008 at 15:22

Craig's user avatar

5

Peter Mortensen's user avatar

answered Dec 4, 2008 at 7:25

1

It has been a pain in 2005 and still is in 2015. Breakpoints will often not hit, probably because of the assemblies being shadow copied or something by the designer(?). The best you can do is to break manually by introducing a call to Debugger.Break(). You may wrap it into a compiler conditional as so:

#if DEBUG
   System.Diagnostics.Debugger.Break(); 
#endif
int line_to = break; // <- if a simple breakpoint here does not suffice

answered Jul 13, 2016 at 10:18

Haymo Kutschbach's user avatar

Haymo KutschbachHaymo Kutschbach

3,3221 gold badge16 silver badges24 bronze badges

2

I have had this happen many times and it is a real pain.

Firstly I’d suggest attempting to follow the stack trace provided by the designer, though I found that often simply lists a bunch of internals stuff that isn’t much use.

If that doesn’t work then try compiling and determining the exception from there. You really are flying blind which is the problem. You could then try simply running the code and seeing what exception is raised when you run it, that should give you some more information.

A last-gasp approach could be to remove all the non-generated code from the form and gradually re-introduce it to determine the error.

If you’re using custom controls you could manually remove the generated code related to the custom controls as well if the previous method still results in an error. You could then re-introduce this step-by-step in the same way to determine which custom control is causing the problem, then go and debug that separately.

Basically as far as I can tell there’s no real way around the problem other than to slog it out a bit!

answered Sep 2, 2008 at 14:36

ljs's user avatar

ljsljs

36.9k36 gold badges105 silver badges124 bronze badges

I discovered why sometimes breakpoints are not hit. In the Attach to Process dialog, «Attach to:» type has to be «Select…»‘d.

Once I changed to «Managed 4.0, 4.5», breakpoints for a WinRT application were hit. Source: Designer Debugging in WinRT.

Peter Mortensen's user avatar

answered Apr 28, 2014 at 23:49

ShawnFeatherly's user avatar

Each one is different and they can sometimes be obscure. As a first step, I would do the following:

  • Use source control and save often. When a designer error occurs, get a list of all changes to the affected controls that have occurred recently and test each one until you find the culprit
  • Be sure to check out the initialization routines of the controls involved. Very often these errors will occur because of some error or bad dependency that is called through the default constructor for a control (an error that may only manifest itself in VS)

answered Sep 2, 2008 at 14:32

Yaakov Ellis's user avatar

Yaakov EllisYaakov Ellis

40.4k27 gold badges131 silver badges173 bronze badges

You can run a second instance of VS and attach it to the first instance of VS (Ctrl+Alt+P). In the first instance set the breakpoints, in the second instance run the designer, and the breakpoint will fire. You can step through the code, but Edit-and-Continue will not work.

For Edit-and-Continue to work, set you control library’s debug options to run a VS with the command line argument being the solution filename. Then you can simply set the breakpoints and hit F5. It will debug just like user code! As a side note, you can do this will VS and Office add-ins also.

answered May 16, 2010 at 18:57

Kevin Phelps's user avatar

1

  • Remove From My Forums
  • Question

  • I’m running VS 2105 Enterprise under Win10 Pro.

    Whether I create a new Universal project or load a sample project I get the same error in Designer (say for MainPage.xaml)… even if there is only a <grid>.  Showing the page in Design view I get this:

    System.NullReferenceException

    Object reference not set to an instance of an object.

    at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MetadataStore.GetTypeConverter(Type type) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.ResolveImplementation(IPlatformMetadata
    platformMetadata, DesignTimePropertyId neutralProperty, IType declaringType, PropertyChangedCallback callback) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, IType
    declaringType, PropertyChangedCallback callback) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlCommonDesignTimeProperties.Initialize(WindowsUIXamlDesignTimeProperties designTimeProperties) at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties..ctor(IPlatformTypes
    platformMetadata) at Microsoft.VisualStudio.DesignTools.UniversalXamlDesigner.UniversalXamlPlatformMetadata.CreateDesignTimeProperties() at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.Metadata.WindowsUIXamlPlatformMetadata.Initialize() at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsStoreXamlPlatform.Initialize()
    at Microsoft.VisualStudio.DesignTools.Platform.PlatformCreatorBase.CreatePlatform(IPlatformReferenceAssemblyResolver referenceAssemblyResolver) at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetProjectContext(IHostProject project,
    IPlatform platform, Boolean create) at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetSourceItemContext(IHostSourceItem sourceItem) at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.CreateDesigner(IHostSourceItem
    item, IHostTextEditor editor, CancellationToken cancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass12_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__0(CancellationToken
    cancelToken) at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass6_0`1.<MarshalInWithCancellation>b__0() at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

    ———————

    Digging down in the Log for VS 2015 I see this error reported>

    626 Begin package load [Windows Forms Designer Events Service Hosting Package] {9DA57A40-22DE-4CC9-896A-500489DCE0E7} VisualStudio 2015/07/31 00:32:25.416
    627 End package load [Windows Forms Designer Events Service Hosting Package] {9DA57A40-22DE-4CC9-896A-500489DCE0E7} VisualStudio 2015/07/31 00:32:25.418
    628 ERROR Assembly timestamp in MEF Cache does not match loaded assembly timestamp
              Microsoft.VisualStudio.TestWindow.Interfaces, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; code-base: file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/CommonExtensions/Microsoft/TestWindow/Microsoft.VisualStudio.TestWindow.Interfaces.dll
    Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost 2015/07/31 00:32:27.849
    629 ERROR Microsoft.VisualStudio.ExtensibilityHosting.InvalidMEFCacheException: The Visual Studio component cache is out of date. Please restart Visual Studio. at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.<LoadAssembly>b__12_0(AssemblyName
    assemblyNameParam) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.SafeGetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`2 valueFactory) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.LoadAssembly(AssemblyName
    assemblyName) at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.GetManifest(Resolver resolver, AssemblyName assemblyName) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.Reflection.TypeRef.GetResolvedTypeArray(ImmutableArray`1
    typeRefs) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteTypeWithoutCollection()
    at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_IsLazy() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_LazyFactory() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport
    import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1
    source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0() at
    System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensIndicatorService.IndicatorCollection.<>c__DisplayClass13_0.<UpdateTemplateCollection>b__0()
    at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)
    Editor or Editor Extension 2015/07/31 00:32:27.936
    630 ERROR Microsoft.VisualStudio.ExtensibilityHosting.InvalidMEFCacheException: The Visual Studio component cache is out of date. Please restart Visual Studio. at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.<LoadAssembly>b__12_0(AssemblyName
    assemblyNameParam) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.SafeGetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`2 valueFactory) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.LoadAssembly(AssemblyName
    assemblyName) at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.GetManifest(Resolver resolver, AssemblyName assemblyName) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.Reflection.TypeRef.GetResolvedTypeArray(ImmutableArray`1
    typeRefs) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteTypeWithoutCollection()
    at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_IsLazy() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_LazyFactory() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport
    import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1
    source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0() at
    System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensIndicatorService.IndicatorCollection.<>c__DisplayClass13_0.<UpdateTemplateCollection>b__0()
    at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call) — End of stack trace from previous location where exception was thrown — at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState
    requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0() at
    System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensIndicatorService.IndicatorCollection.<>c__DisplayClass13_0.<UpdateTemplateCollection>b__0()
    at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)
    Editor or Editor Extension 2015/07/31 00:32:27.993
    631 ERROR Microsoft.VisualStudio.ExtensibilityHosting.InvalidMEFCacheException: The Visual Studio component cache is out of date. Please restart Visual Studio. at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.<LoadAssembly>b__12_0(AssemblyName
    assemblyNameParam) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.SafeGetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`2 valueFactory) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.LoadAssembly(AssemblyName
    assemblyName) at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.GetManifest(Resolver resolver, AssemblyName assemblyName) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.Reflection.TypeRef.GetResolvedTypeArray(ImmutableArray`1
    typeRefs) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteTypeWithoutCollection()
    at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_IsLazy() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_LazyFactory() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport
    import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1
    source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0() at
    System.Lazy`1.CreateValue() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Lazy`1.get_Value() at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensIndicatorService.IndicatorCollection.<>c__DisplayClass13_0.<UpdateTemplateCollection>b__0()
    at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)
    Editor or Editor Extension 2015/07/31 00:32:28.101
    632 ERROR

    Microsoft.VisualStudio.ExtensibilityHosting.InvalidMEFCacheException: The Visual Studio component cache is out of date. Please restart Visual Studio. at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.<LoadAssembly>b__12_0(AssemblyName
    assemblyNameParam) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.SafeGetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`2 valueFactory) at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.LoadAssembly(AssemblyName
    assemblyName) at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.GetManifest(Resolver resolver, AssemblyName assemblyName) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.Reflection.TypeRef.GetResolvedTypeArray(ImmutableArray`1
    typeRefs) at Microsoft.VisualStudio.Composition.Reflection.TypeRef.get_ResolvedType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteType() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteTypeWithoutCollection()
    at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_IsLazy() at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_LazyFactory() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport
    import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1
    source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0() at
    System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensIndicatorService.IndicatorCollection.<>c__DisplayClass13_0.<UpdateTemplateCollection>b__0()
    at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call) — End of stack trace from previous location where exception was thrown — at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState
    requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker
    importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
    at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
    at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0() at
    System.Lazy`1.CreateValue() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Lazy`1.get_Value() at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensIndicatorService.IndicatorCollection.<>c__DisplayClass13_0.<UpdateTemplateCollection>b__0()
    at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)

    ——————

    as told… I went to Tools> Options> XAML Designer and unchecked «Run project code in the XAML Designer (if supported)» … but it made no difference…

    Designer does not work in EITHER VS 2015 Enterprise / Win10 Pro  OR  Blend 2015

    Please help, I’m totally stuck

    Tom


    Tom

Answers

  • This worked for me on 2 different HP products (HP sets the «Platform» environment variable).

    delete the «Platform» environment variable in System->Advanced System Settings->Environment Variables …

    In my case it said =HPD


    Roman Müller, Founder and CEO — Interware LLC

    • Proposed as answer by

      Wednesday, August 5, 2015 7:51 AM

    • Marked as answer by
      Jiayi Li
      Friday, August 7, 2015 8:52 AM



Only Visible to You and DevExpress Support


Visible to All Users

Modify
support ticket and change its visibility



Urgent



Duplicate

We have closed this ticket because another page addresses its subject:

Disclaimer: The information provided on DevExpress.com and its affiliated web properties is provided «as is» without warranty of any kind.
Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose.
Please refer to the DevExpress.com Website Terms of Use for more information.

Recently viewed tickets

You have yet to view any tickets.

Your search criteria do not match any tickets.

A server error occurred while processing your request. Please try again at a later time.

Я могу избежать перезапуска VS, выполнив следующие действия

  1. Добавить новый пользовательский элемент управления
  2. Перетащите на него некоторые из ваших пользовательских элементов управления (если это дает вам ошибку, создайте решение еще раз).
  3. Восстановите свой контроль.

В моем случае у меня есть проект winforms с несколькими настраиваемыми элементами управления, которые используются другими настраиваемыми элементами управления. Всякий раз, когда я открываю некоторые из этих настраиваемых элементов управления, я получаю сообщение об ошибке «Базовый класс …». Добавление нового настраиваемого элемента управления, построение проекта и затем добавление некоторых настраиваемых элементов управления из моего проекта в новый настраиваемый элемент управления позволило мне открыть настраиваемые элементы управления, которые выдавали мне ошибку «Базовый класс …».

ОБНОВЛЕНИЕ: я думаю, что нашел проблему. Мои элементы управления не были «добавлены» должным образом в файл csproj. В файле csproj файлы для частичных классов элементов управления / компонентов пользовательского интерфейса нуждаются в атрибуте DependentUpon.

Пример: до:

<Compile Include="WindowsFormsDataGridView.cs">
    <SubType>Component</SubType>
</Compile>
<Compile Include="WindowsFormsDataGridView.Designer.cs" />

после:

<Compile Include="WindowsFormsDataGridView.cs">
    <SubType>Component</SubType>
</Compile>
<Compile Include="WindowsFormsDataGridView.Designer.cs">
    <DependentUpon>DataGridView.cs</DependentUpon>
</Compile>

Permalink

Cannot retrieve contributors at this time

title description ms.custom ms.date ms.topic f1_keywords helpviewer_keywords ms.assetid author ms.author manager ms.technology ms.workload

Class Designer errors

Learn how to resolve Class Design errors by dragging the modified or relocated source code to the class diagram again to display it.

SEO-VS-2020

11/04/2016

troubleshooting

vs.classdesigner.CPlusPlusViewInDiagramNoTypeFound

vs.classdesigner.CPlusPlusNoTypeFound

vs.classdesigner.CannotShowBaseType

vs.classdesigner.MatchOrphanTypesAtLoad

vs.classdesigner.CannotShowType

vs.classdesigner.AssociationTypeNotFoundError

vs.classdesigner.ViewInDiagramNoTypesFound

vs.classdesigner.CannotImplementInterface

vs.classdesigner.CannotShowImplementedInterface

vs.classdesigner.ViewInDiagramUnparsableTypeFound

vs.classdesigner.AssociationTypeNotFound

vs.classdesigner.CPlusPlusTypeCannotBeAdded

errors, class diagrams

errors, Class Designer

error messages, Class Designer

error messages, class diagrams

Class Designer [Visual Studio], errors

class diagrams, errors

79d70e70-704c-4255-ab68-c10d6949470e

TerryGLee

tglee

jmartens

vs-ide-general

multiple

Class Designer errors

[!INCLUDE Visual Studio]

Class Designer does not track the location of your source files, so modifying your project structure or moving source files in the project can cause Class Designer to lose track of the type, For example, it’s common to modify the source type of a typedef, base classes, and association types. You might receive an error such as Class Designer is unable to display this type. To resolve the error, drag the modified or relocated source code to the class diagram again to display it.

Resources

You can find assistance with other errors and warnings in the following resources:

  • Work with Visual C++ code includes troubleshooting information about displaying C++ in a class diagram.
  • Visual Studio Class Designer forum provides a forum for questions about Class Designer.

See also

  • Design and view classes and types

Я использую VS2010, и если у меня есть форма, открытая в режиме конструктора и запускающая мое приложение, вкладка конструктора больше не будет показывать конструктор форм, но вместо этого будет отображаться ошибка (и она фиксируется только при перезапуске IDE) говоря:

«Чтобы предотвратить возможную потерю данных перед загрузкой конструктора, следует устранить следующие ошибки:»

1 Ошибка:

«Дизайнер не может быть показан для этого файла, потому что ни один из классы внутри него могут быть разработаны. Дизайнер осмотрел следующие классы в файле: ##### — Базовый класС##### может не загружается. Убедитесь, что на сборке указаны ссылки и что все проекты были построены»

Затем я показываю следующий стек вызовов:

в System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(менеджер IDesignerSerializationManager)
в System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(менеджер IDesignerSerializationManager)
в Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
в System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(узел IDesignerLoaderHost)

Любая помощь очень признательна, это действительно раздражает.

Спасибо,

Joel.

4b9b3361

Ответ 1

Я получаю эту визуальную студийную ошибку тоже время от времени, и я глубоко игнорирую текст ошибки, вместо этого я делаю следующее:

  • Закройте вкладку «Дизайн»
  • Открывает режим разработки двойным щелчком в обозревателе решений или щелчком правой кнопкой мыши вкладку «Исходный код» и выберите «Просмотреть конструктор»
  • Вдруг все работает снова!

Если вы не поможете, вам, возможно, придется сменить пулю 2 на:
Закройте и перезапустите Visual Studio.

Возможно, это может помочь вам.

Ответ 2

Я обычно закрываю визуальную форму, перестраиваю решение, щелкаю правой кнопкой мыши, затем выбираю «представление конструктора» в коде формы.

Очень, очень раздражает. Я думаю вернуться к VS2008.

Ответ 3

Закройте форму. Очистите раствор. Перестройте решение. Повторно открыть форму. Работал для меня, когда ничего другого не было.

Ответ 4

Я могу избежать перезапуска VS, выполнив следующие

  • Добавить новый пользовательский элемент управления
  • Перетащите некоторые пользовательские элементы управления на него (если оно дает вам ошибку, снова создайте решение).
  • Восстановите свой контроль.

В моем случае у меня есть проект winforms с несколькими настраиваемыми элементами управления, которые используются другими настраиваемыми элементами управления. Всякий раз, когда я открываю некоторые из этих настраиваемых элементов управления, я получаю ошибку «Базовый класс…». Добавление нового настраиваемого элемента управления, создание проекта, а затем добавление некоторых пользовательских элементов управления из моего проекта в новый настраиваемый элемент управления позволило мне открыть настраиваемые элементы управления, которые давали мне ошибку «Базовый класс…».

ОБНОВЛЕНИЕ: Я думаю, что нашел проблему. Мои элементы управления не были правильно добавлены в файл csproj. В файле csproj файлы для частичных классов элементов/компонентов пользовательского интерфейса должны иметь атрибут «DependentUpon».

E.x.:
раньше:

<Compile Include="WindowsFormsDataGridView.cs">
    <SubType>Component</SubType>
</Compile>
<Compile Include="WindowsFormsDataGridView.Designer.cs" />

после

<Compile Include="WindowsFormsDataGridView.cs">
    <SubType>Component</SubType>
</Compile>
<Compile Include="WindowsFormsDataGridView.Designer.cs">
    <DependentUpon>DataGridView.cs</DependentUpon>
</Compile>

Ответ 5

У меня была такая же проблема, и я смог решить эту проблему, создав новый проект, а затем скомпилировав и запустив проект, а затем я импортировал все файлы и снова запускал проект, и автоматически он работал снова, ничего лишнего не делал.

Ответ 6

У меня была ситуация, когда пользовательский элемент управления, похоже, создавал ошибку (не уверен, почему), поэтому я удалил ссылки на пользовательский элемент управления из формы, и ошибка исчезла.

Ответ 7

Кажется, что после установки SP1 проблема ушла.

Спасибо за вашу помощь всем.

Ответ 8

У меня была та же проблема с использованием элемента управления с помощью Generics

      MvpUserControl<Presenter,IViewMode> : UserControl

что я делаю. Удалите ссылку и добавьте снова, очистите и перестройте решение. Надеюсь, это может быть полезно для кого-либо еще.

Ответ 9

У меня была такая же проблема с VS2010 SP1. Наконец, с помощью Центра обновления Windows я увидел некоторые обновления для Visual Studio и .Net, я их установил и больше не происходит.

Ответ 10

Старый пост, но для тех, кто может найти это…

Просто вмешался в эту ошибку, и для меня это было относительно простое исправление.

Установлено, что это может иметь какое-то отношение к именам ваших классов и переименовать проблематичный класс в более высокий порядок. Это алфавитный порядок, который он появляется в сборке (где A выше Z).

Статья MSDN

Удачи.

Ответ 11

Эта ошибка возникает, если класс Form не является первым классом в файле, например, если в начале файла есть вспомогательный класс.

Чтобы решить эту проблему, переместите все остальные классы, кроме класса Form, в нижнюю часть файла.

Ответ 12

Не используйте код Form1.Designer.cs. Переместите свою логику в Form1.cs (нажмите F7 на вкладке Form1.cs [Дизайн]).

Ответ 13

«В файле проекта (.vcxproj) найдите запись для цели Рамочная версия. Например, если ваш проект предназначен для использования .NET Framework 4.5, найдите v4.5 в  элемент элемента.»

(Microsoft)

В моем случае «v4.5» не существовало, поэтому я добавляю его, и теперь все хорошо.

Ответ 14

Я попробовал чистое решение и пересобрать решение и работал на меня. Надеюсь, это поможет!

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Design time error
  • Description unexpected error minecraft
  • Description the server encountered an internal error that prevented it from fulfilling this request
  • Description mod loading error has occurred
  • Description invalid query как исправить

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии