gpt4 book ai didi

c# - Visual Studio 2015(社区)设计器显示空白通用应用程序的 NullReferenceException

转载 作者:可可西里 更新时间:2023-11-01 08:44:10 25 4
gpt4 key购买 nike

我对此感到有点沮丧,也许有人遇到过类似的问题或者知道如何解决它。

我升级到 Windows 10。
我安装了 Visual Studio 2015 Community。
我创建了一个新的解决方案,只有 1 个项目用于空白的通用 Windows 应用程序。我正在使用 C#。

问题:我尝试在设计器中打开 MainPage.xaml,但设计器不会加载。我在设计器窗口中得到一个 NullReferenceException。我尝试在 Blend 中打开它,结果相同。正如 Visual Studio 所建议的,我尝试关闭“选项”菜单中的“在 XAML 设计器中运行项目代码”功能,但没有帮助。

虽然在设计器中打开其他 xaml 文件没有问题(WPF、Windows Phone 8 或 8.1 通用应用程序都可以正常工作)。该应用程序既可以在本地机器上运行,也可以在模拟器中运行,只是设计人员在起作用。

欢迎提出任何建议。

编辑

设计器窗口异常:

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()

System.NullReferenceException
Object reference not set to an instance of an object.

Server stack trace:
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalInSynchronous(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.MarshalInWithCancellation[TResult](IRemoteCancellationToken remoteToken, Func`2 func, ApartmentState apartmentState)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken remoteToken)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.CreateDesignerImpl(IRemoteDesignerService ds, IHostSourceItem item, IHostTextEditor editor, RemoteCancellationToken remoteCancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass14_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerService.CreateDesigner>b__0(IRemoteDesignerService ds, RemoteCancellationToken remoteToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass5_0`1.<MarshalOutWithCancellation>b__0(IRemoteDesignerService ds)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass27_0`1.<MarshalOut>b__0()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal, CancellationToken cancelToken, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CancellationToken cancelToken, CallSynchronizationMode syncMode, WaitHandle timeoutSignal, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action`1 action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.MarshalOutWithCancellation[TResult](CancellationToken cancelToken, Func`3 func, ApartmentState apartmentState)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)

最佳答案

如果您使用的是 HP,这对我有用:

在系统->高级系统设置->环境变量中删除“平台”环境变量...

在我的例子中它说 =HPD

关于c# - Visual Studio 2015(社区)设计器显示空白通用应用程序的 NullReferenceException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31728169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com