I am having the following exception in visual studio xaml designer when trying to open a xaml file.
System.BadImageFormatException
Index not found. (Exception from HRESULT: 0x80131124)
at Microsoft.MetadataReader.IMetadataAssemblyImport.GetAssemblyRefProps(Token token, EmbeddedBlobPointer& pPublicKey, Int32& cbPublicKey, StringBuilder szName, Int32 cchName, Int32& pchName, AssemblyMetaData& pMetaData, UnusedIntPtr& ppbHashValue, UInt32& pcbHashValue, AssemblyNameFlags& dwAssemblyRefFlags)
at Microsoft.MetadataReader.AssemblyNameHelper.AssemblyNameFromRefBuilder.Fetch()
at Microsoft.MetadataReader.AssemblyNameHelper.AssemblyNameBuilder.CalculateName()
at Microsoft.MetadataReader.AssemblyNameHelper.GetAssemblyNameFromRef(Token assemblyRefToken, MetadataOnlyModule module, IMetadataAssemblyImport assemblyImport)
at Microsoft.MetadataReader.MetadataOnlyAssembly.GetReferencedAssemblies()
at Microsoft.VisualStudio.DesignTools.Designer.Assemblies.AssemblyService.BuildCurrentReachableAssemblies(Assembly assembly, HashSet`1 reachableAssemblyNames, Assembly[] appDomainAssemblies)
at Microsoft.VisualStudio.DesignTools.Designer.Assemblies.AssemblyService.DetermineReachableImplicitAssemblyReferences(IEnumerable`1 referencedAssemblies)
at Microsoft.VisualStudio.DesignTools.Designer.Assemblies.ProjectAssemblyResolver.UpdateImplicitReferencesInternal(Boolean ensureMetadataLoaded)
at Microsoft.VisualStudio.DesignTools.Designer.Assemblies.ProjectAssemblyResolver.Initialize()
at Microsoft.VisualStudio.DesignTools.Designer.Assemblies.ProjectAssemblyService.GetProjectAssemblyResolver(IHostProject project)
at Microsoft.VisualStudio.DesignTools.Designer.Assemblies.ProjectAssemblyService.CreatePlatformReferenceAssemblyResolver(IHostProject project)
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.BadImageFormatException
Index not found. (Exception from HRESULT: 0x80131124)
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__DisplayClass29_0`1.<MarshalOut>b__0()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
System.BadImageFormatException
Index not found. (Exception from HRESULT: 0x80131124)
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)
Iam not even able to open the xaml file in blend, the exception is the same. The thing is that the application is buildable, it even runs with no problem. I checked and all the referenced assemblies are build either as MSIL or x86 -> iam building my wpf app in x86. I also tried to debug the xdesproc but not moved further, just this exception.
Anyone could help with this? There is nothing I can build on to investigate further. I would really appreciate just a tiny hint on this.
Many thanks.
User contributions licensed under CC BY-SA 3.0