本文介绍了WPF 设计器无法在 VS 11 beta 中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我在使用 Visual Studio 11 beta WPF 设计器时遇到了一个奇怪的错误(即,谷歌在搜索堆栈跟踪的一部分时没有返回任何结果)I'm experiencing a weird error with the visual studio 11 beta WPF designer (i.e. google does not return any results while searching for a part of the stacktrace)问题来了:当我创建一个 WPF 应用程序项目,然后向其中添加窗口或用户控件时,我在嵌入式 WPF 设计器中编辑它们没有问题.但是当我创建一个 WPF 用户控件项目时,我无法让它工作:我在下面粘贴了一个奇怪的错误.Here is the problem:When I create a WPF application project, and then add windows or usercontrols to it, I have no problems editing them in the embedded WPF designer.But when I create a WPF user control project, I cannot manage to get it working: I have the weird error I pasted below.我的目标是 .Net 4.5 ... 而我的 VS 是法语(抱歉).为了便于搜索,我粘贴了此问题的文本和图像,以便于阅读.I'm targeting .Net 4.5 ... and my VS is in french (sorry).I pasted the text for this question to be searcheable, and an image as well, for readability.我会将错误消息的第一部分翻译为(对不起我的英语......)尝试从网络源加载程序集,这意味着在 .Net 框架的早期版本中以沙箱模式使用程序集.由于此 .Net 框架版本默认不激活 CAS 策略,因此这种加载可能很危险.等等... I would translate the first part of the error message as (sorry for my english...)Trying to load an assembly from a network source, which has implied using the assembly in sandbox mode in previous version of .Net framework. Since this .Net framework version does not activate CAS strategy by default, this loading might be dangerous.etc...System.NotSupportedException 暂定dechargement d'un assemblyàpartir d'un emplacement réseau qui aurait entraîné l'utilisation del'assembly en mode Bac à sable (sandbox) dans les versions antérieures.NET 框架.Cette version du .NET Framework n'activant pas laStratégie CAS par défaut, ce chargement peut être riskeux.赛Chargement n'est pas destiné à utiliser l'assembly en mode Bac à sable(沙盒),activez le 换向器 loadFromRemoteSources.倒加d'informations, 咨询http://go.microsoft.com/fwlink/?LinkId=155569.一种Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.DirectInvoke[T](WaitHandle中止, Func1 func) àMicrosoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle1targetObject, Func1 func) àMicrosoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle1targetObject, Func`2 func) àMicrosoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.Microsoft.Expression.DesignHost.IDesignerService.CreateDesigner(IHostSourceItem项,IHostTextEditor 编辑器)àMicrosoft.Expression.DesignHost.IsolatedDesignerService.CreateDesignerViewInfo(IIsolationTarget隔离目标,IHostSourceItem 项目,IHostTextEditor 编辑器,CancellationTokenSource 取消源)System.NotSupportedException 暂定dechargement d'un assemblyàpartir d'un emplacement réseau qui aurait entraîné l'utilisation del'assembly en mode Bac à sable (sandbox) dans les versions antérieures.NET 框架.Cette version du .NET Framework n'activant pas laStratégie CAS par défaut, ce chargement peut être riskeux.赛Chargement n'est pas destiné à utiliser l'assembly en mode Bac à sable(沙盒),activez le 换向器 loadFromRemoteSources.倒加d'informations, 咨询http://go.microsoft.com/fwlink/?LinkId=155569.System.NotSupportedException Tentative de chargement d'un assembly à partir d'un emplacement réseau qui aurait entraîné l'utilisation de l'assembly en mode Bac à sable (sandbox) dans les versions antérieures du .NET Framework. Cette version du .NET Framework n'activant pas la stratégie CAS par défaut, ce chargement peut être dangereux. Si ce chargement n'est pas destiné à utiliser l'assembly en mode Bac à sable (sandbox), activez le commutateur loadFromRemoteSources. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkId=155569.服务器堆栈跟踪:在Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.WaitForCompletion(BlockingCall打电话)在Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.Invoke(BlockingCall打电话)在Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.Invoke[T](Func1func,WaitHandle 中止)在Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObjecttargetObject, Func1 func) atMicrosoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostSourceItemremoteItem、IRemoteHostTextEditor 远程编辑器)在System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtrmd,对象[] args,对象服务器,对象[]&outArgs) 在System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage味)Server stack trace: at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.WaitForCompletion(BlockingCall call) at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.Invoke(BlockingCall call) at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.Invoke[T](Func1 func, WaitHandle aborted) at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObject targetObject, Func1 func) at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)在 [0] 处重新抛出异常:àSystem.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessagereqMsg, IMessage retMsg) àSystem.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData, Int32 类型) àMicrosoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostSourceItem远程项目,IRemoteHostTextEditor 远程编辑器)àMicrosoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.c__DisplayClass8.b__7(IRemoteDesignerServiced) àMicrosoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.c__DisplayClass42.b__3()一种Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.DirectInvoke[T](WaitHandleabort, Func1 func)Exception rethrown at [0]: à System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) à System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) à Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor) à Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass8.b__7(IRemoteDesignerService d) à Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass42.<MarshalOut>b__3() à Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.DirectInvoke[T](WaitHandle abort, Func1 func)System.NotSupportedException 暂定dechargement d'un assemblyàpartir d'un emplacement réseau qui aurait entraîné l'utilisation del'assembly en mode Bac à sable (sandbox) dans les versions antérieures.NET 框架.Cette version du .NET Framework n'activant pas laStratégie CAS par défaut, ce chargement peut être riskeux.赛Chargement n'est pas destiné à utiliser l'assembly en mode Bac à sable(沙盒),activez le 换向器 loadFromRemoteSources.倒加d'informations, 咨询http://go.microsoft.com/fwlink/?LinkId=155569.在System.Reflection.RuntimeAssembly.nLoadFile(字符串路径,证据证据)在 System.Reflection.Assembly.LoadFile(String path) 在Microsoft.Expression.Utility.AssemblyHelper.LoadFile(字符串路径)在Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.CreateClassicShadowCopy(IHostProject项目,字符串 assemblySourcePath) 在Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.ResolveShadowCopyAssembly(IHostProject项目,字符串路径)在Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.ResolveAssembly(IHostProject项目,字符串路径)在Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(字符串路径)在Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(IHostReferenceItem参考)在Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.UpdateAssemblyReferences(IEnumerable1引用更新)在Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver..ctor(IHostProject项目,DesignerContext 设计器上下文)在Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyService.<.ctor>b__0(IHostProject项目)在Microsoft.Expression.Utility.Collections.SuspendableKeyedCollection2.CreateItems(TKey键)在System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKeykey, Func2 valueFactory) 在Microsoft.Expression.Utility.Collections.SuspendableKeyedCollection2.GetItem(TKey键)在Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyService.GetProjectAssemblyResolver(IHostProject项目)在Microsoft.Expression.DesignSurface.Project.ProjectContextBase.Initialize()在Microsoft.Expression.DesignSurface.Project.XamlProjectContext.Initialize()在Microsoft.Expression.DesignSurface.Project.ProjectContextManager.GetProjectContext(IHostProject项目,IPlatform 平台)在Microsoft.Expression.DesignSurface.Project.ProjectContextManager.d__20.MoveNext()在Microsoft.Expression.DesignSurface.Project.XamlProjectContext.get_Application()在Microsoft.Expression.DesignSurface.Documents.SceneDocument.GetApplicationDocument(IXamlProjectContext活动上下文)在Microsoft.Expression.DesignSurface.Documents.SceneDocument.get_ApplicationSceneDocument()在Microsoft.Expression.DesignSurface.DocumentViewContext.CreateAndOpenView(ISourceItemContextsourceItem, Boolean activate, Boolean ensureOpen) atMicrosoft.Expression.DesignSurface.DesignerService.CreateDesigner(IHostSourceItem项,IHostTextEditor 编辑器)在Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass9.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__8()在Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.<>c__DisplayClassa1.b__9()在Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.Call.Invoke()System.NotSupportedException Tentative de chargement d'un assembly à partir d'un emplacement réseau qui aurait entraîné l'utilisation de l'assembly en mode Bac à sable (sandbox) dans les versions antérieures du .NET Framework. Cette version du .NET Framework n'activant pas la stratégie CAS par défaut, ce chargement peut être dangereux. Si ce chargement n'est pas destiné à utiliser l'assembly en mode Bac à sable (sandbox), activez le commutateur loadFromRemoteSources. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkId=155569. at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String path) at Microsoft.Expression.Utility.AssemblyHelper.LoadFile(String path) at Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.CreateClassicShadowCopy(IHostProject project, String assemblySourcePath) at Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.ResolveShadowCopyAssembly(IHostProject project, String path) at Microsoft.Expression.DesignSurface.Assemblies.AssemblyService.ResolveAssembly(IHostProject project, String path) at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(String path) at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.GetAssemblyInformation(IHostReferenceItem reference) at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver.UpdateAssemblyReferences(IEnumerable1 referencesToUpdate) at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyResolver..ctor(IHostProject project, DesignerContext designerContext) at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyService.<.ctor>b__0(IHostProject project) at Microsoft.Expression.Utility.Collections.SuspendableKeyedCollection2.CreateItems(TKey key) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.Expression.Utility.Collections.SuspendableKeyedCollection2.GetItem(TKey key) at Microsoft.Expression.DesignSurface.Assemblies.ProjectAssemblyService.GetProjectAssemblyResolver(IHostProject project) at Microsoft.Expression.DesignSurface.Project.ProjectContextBase.Initialize() at Microsoft.Expression.DesignSurface.Project.XamlProjectContext.Initialize() at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform) at Microsoft.Expression.DesignSurface.Project.ProjectContextManager.<GetContextsInActiveSolution>d__20.MoveNext() at Microsoft.Expression.DesignSurface.Project.XamlProjectContext.get_Application() at Microsoft.Expression.DesignSurface.Documents.SceneDocument.GetApplicationDocument(IXamlProjectContext activeContext) at Microsoft.Expression.DesignSurface.Documents.SceneDocument.get_ApplicationSceneDocument() at Microsoft.Expression.DesignSurface.DocumentViewContext.CreateAndOpenView(ISourceItemContext sourceItem, Boolean activate, Boolean ensureOpen) at Microsoft.Expression.DesignSurface.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor) at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass9.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__8() at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.<>c__DisplayClassa1.b__9() at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.CallQueue.Call.Invoke()推荐答案我似乎通过将 loadFromSources 设置为启用来解决问题,如下所述:I appear to have fixed things by setting loadFromSources to enabled as described here:转到 C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE使用文本编辑器(可能需要管理员模式)打开文件 XDesProc.exe.config、devenv.exe.config 和 XDesProc.exe.appx.config查找</runtime>在它之前,添加 <loadFromRemoteSources enabled="true"/>(如果您复制/粘贴,请确保双引号以 ASCII 或 VS 的形式出现)(来源:http://www.sehajpal.com/index.php/2010/10/how-to-solve-loadfromremotesources-error-in-vs-2010/)也许只有对 XDesProc.exe.config 才真正需要这样做,我不知道.Perhaps it is only really necessary to do this for XDesProc.exe.config, I don't know.在那之后,我得到了一个不同的错误,找不到方法:'Boolean Microsoft.Windows.Design.PropertyEditing.PropertyFilter.get_IsFiltering()':After that, I got a different error, Method not found: 'Boolean Microsoft.Windows.Design.PropertyEditing.PropertyFilter.get_IsFiltering()' :修复:将文件 Microsoft.Windows.Design.Interaction.dll 从 c:\Program Files (x86)\Microsoft Expression\Blend for Visual Studio\Microsoft.Windows.Design.Interaction\ 复制到 c:\Program Files (x86)\Microsoft VisualStudio 11.0\Common7\IDE\PublicAssemblies\(您可能希望先备份现有文件.)Fix: Copy the file Microsoft.Windows.Design.Interaction.dll from c:\Program Files (x86)\Microsoft Expression\Blend for Visual Studio\Microsoft.Windows.Design.Interaction\ to c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\ (You may wish to make a backup of the existing file first.)(来源:http://connect.microsoft.com/VisualStudio/feedback/details/728263/xaml-editor-reports-unexpected-error-microsoft-expression-designhost-isolation-remoting-remoteexception)微软有人说不支持在开发者预览版上安装 Beta,所以也许这就是我遇到第二个问题的原因.Someone from Microsoft said installing the Beta over the Developer Preview isn't supported so maybe that's why I had this 2nd problem. 这篇关于WPF 设计器无法在 VS 11 beta 中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-18 17:43