Visual Studio 2013 Code Analysis Exception CA0055: Could not load assembly - visual-studio-2013

I am trying to run the Code analysis on Web Project in VS2013 but i am getting the exception CA0055.
I took a look at the log file. Here is the exception information which is getting logged.
<Exception Keyword="CA0055" Kind="AssemblyLoad">
<Type>Microsoft.FxCop.Common.AssemblyLoadException</Type>
<ExceptionMessage>Could not load MyProject.dll.</ExceptionMessage>
<InnerType>System.NullReferenceException</InnerType>
<InnerExceptionMessage>Object reference not set to an instance of an object.</InnerExceptionMessage>
<InnerStackTrace> at Phx.Metadata.ReaderImplementation.CreateTokenMap()
at Phx.Metadata.MetadataLoader.GetModule(String fileName, FileInfo fileInfo, AssemblyUnit unit)
at Phx.Metadata.MetadataLoader.GetAssembly(String fileName, AssemblyUnit unit)
at Phx.Metadata.MetadataLoader.LoadAssemblyDefinition(AssemblyUnit unit)
at Microsoft.FxCop.Engines.Phoenix.AssemblyLoader.ProcessWorklist(MetadataLoader metadataLoader, Boolean ignoreErrors)
at Microsoft.FxCop.Engines.Phoenix.AssemblyLoader.LoadAttributeType(AggregateType type, MetadataLoader metadataLoader)
at Microsoft.FxCop.Engines.Phoenix.AssemblyLoader.LoadAttributes(List`1 attributes, MetadataLoader metadataLoader)
at Microsoft.FxCop.Engines.Phoenix.AssemblyLoader.LoadAttributes(ProgramUnit programUnit, MetadataLoader metadataLoader)
at Microsoft.FxCop.Engines.Phoenix.AssemblyLoader.LoadAssembly(String filePath)
at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.AnalyzeInternal()
</InnerStackTrace>
</Exception>
Does any one came across the same type of issue?Any clue would be of great help.

Related

Error opening MDriven EcoSpace or PMP component designers in Visual Studio .NET Standard project

I created a new .netstandard2.0 MDrivenEcoSpaceAndModelForNetStandard2 project. When it is created, I am not able to open the ecospace or the PMP component designers. I'm using Microsoft Visual Studio Enterprise 2019 Version 16.8.4 and MDriven Framework version 7.0.0.12868. I get the following error when opening the PMP. (BTW, Thanks, I am very happy to see the support for .net standard. Looking forward to getting this component designer issue figured out and everything working again. It's been a very long road converting all my projects over to .net standard/core). Any help is greatly appreciated.
"Unsupported type argument in custom attribute signature."
Instances of this error (1)
Call Stack
at Microsoft.MetadataReader.SignatureUtil.GetTypeId(Type type)
at Microsoft.MetadataReader.MetadataOnlyModule.GetConstructorArguments(ConstructorInfo constructorInfo, Byte[] customAttributeBlob, Int32& index)
at Microsoft.MetadataReader.MetadataOnlyModule.LazyAttributeParse(Token token, ConstructorInfo constructorInfo, IList1& constructorArguments, IList1& namedArguments)
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.InitArgumentData()
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.get_ConstructorArguments()
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.ConstructAttribute(CustomAttributeData data)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(ICustomAttributesDataProvider member, Type filter, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(Type type, Type filter, Boolean inherit, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.GetCustomAttributes(Type filter, Boolean inherit)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(Type type, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(MemberInfo member, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.get_Attributes()
at Microsoft.VisualStudio.Design.VSDesignSurface.EnsureExtensions(IComponent component)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type type)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
Slightly different call stack when opening the ecospace:
Instances of this error (1)
Call Stack
at Microsoft.MetadataReader.SignatureUtil.GetTypeId(Type type)
at Microsoft.MetadataReader.MetadataOnlyModule.GetConstructorArguments(ConstructorInfo constructorInfo, Byte[] customAttributeBlob, Int32& index)
at Microsoft.MetadataReader.MetadataOnlyModule.LazyAttributeParse(Token token, ConstructorInfo constructorInfo, IList1& constructorArguments, IList1& namedArguments)
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.InitArgumentData()
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.get_ConstructorArguments()
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.ConstructAttribute(CustomAttributeData data)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(ICustomAttributesDataProvider member, Type filter, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(Type type, Type filter, Boolean inherit, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.GetCustomAttributes(Type filter, Boolean inherit)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(Type type, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(MemberInfo member, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.get_Attributes()
at Microsoft.VisualStudio.Design.VSDesignSurface.EnsureExtensions(IComponent component)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type type)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
MDriven had real issues with the new project file format. It behaves very differently in our CodeGen and Save extensions for Visual Studio.
This is however now improved and we think all is fine from version 7.0.0.12950 and onwards.
When it comes to open designer for EcoSpace and PMP we still have issues - but it seems we are not alone since the same issues shows when trying to open a winforms designer. We will need to see how Visual Studio future release handles this.
Workaround is to link the files to a .netFramework project and edit them there - but compile them in .netstandard/core

UFT Report is broken

Lately we are getting more and more often confronted with problems with UFT. Many API components can't executed anymore, but there are 2 possible outputs:
UFT gives a message from "object reference not set to an instance of an object" without even starting the test, let alone reporting. The Output Pane contains the following message:
Start
object reference not set to an instance of an object
End
when we execute a test using ALM we get a KeyNotFoundException:
2020-01-22 12:04:38,039 HP.ST.Fwk.ReporterFWK.Reporter [ 1] ERROR Problem in writing Step Xml
System.Collections.Generic.KeyNotFoundException: The specified key was not listed in the dictionary.
For System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
for HP.ST.Fwk.ReportCreator.QTPEngine.Utils.GetNodeInfo(Object stepId, XmlDocument xmlDoc, IReportDataContainer reportData)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateOuterCheckpointsXML(Object stepId, XmlDocument doc, XmlNode node, String innerCheckpointsFileName, String childId, IReportDataContainer reportDataContainer)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateFileForReferencedValues(XmlDocument doc, XmlNode& reportNode, Object stepId, IReportDataContainer reportDataContainer)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateXmlFile(Dictionary`2 nodeInfo, Object stepId, XmlDocument doc, IReportDataContainer IReportDataContainer)
for HP.ST.Fwk.ReporterFWK.Reporter.WriteStepToDisk(String stepId, String fileName)
for HP.ST.Fwk.ReporterFWK.Reporter.<>c__DisplayClass36_0.<FlushReport>b__0()
for System.Threading.Tasks.Task.InnerInvoke()
for System.Threading.Tasks.Task.Execute()
We've tried every direction, reinstalling UFT, patching... all to no avail. The behavior seems to be present in both UFT 14.53 and UFT 14.53 Patch 1 - 3. UFT One is also affected.
The UFT support could not help us at all, you know how they are.

MissingMetadataException when building UWP app with .Net native

I have this UWP app that uses a project (UWP class library) which itself uses EF7 and SQLite.
I tried to build the app in the Release mode using .Net native tool chain, the build completes successfully (after a good long time, and after eating as much memory as it can), but the application crashes just after leaving the splash screen.
After following some advice on SO I tried the .Net native with Debug mode, the build finishes just like in the Release mode, but I get many errors on the output window and it is the same scenario as this one UWP - .NET Native tool chain compilation error
I followed #Matt Whilden advice, and I got rid of those errors, then tried again.
This time I got hit by this famous MissingMetadataException :
The output window shows this :
Exception thrown: 'System.AggregateException' in System.Private.Threading.dll
Exception thrown: 'System.ArgumentException' in System.Linq.Expressions.dll
Exception thrown: 'System.ArgumentException' in System.Linq.Expressions.dll
Exception thrown: 'System.ArgumentException' in System.Linq.Expressions.dll
The thread 0x2a30 has exited with code 0 (0x0).
Exception thrown: 'System.Reflection.MissingMetadataException' in System.Private.Reflection.Core.dll
Additional information: 'Microsoft.Extensions.Caching.Memory.MemoryCacheOptions' is missing
metadata. For more information, please visit
http://go.microsoft.com/fwlink/?LinkID=392859
I tried to follow my code, during execution and I found out that it is caused by the first ever call to a DbSet table from my DbContext
public long GetLastTimeStamp()
{
//-----> Here is the line causing the error
var sortedArticles = DbContext.Articles.OrderByDescending(article => article.ArticlePubDate).ToList();
if (sortedArticles != null && sortedArticles.Count != 0)
{
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local);
TimeSpan elapsedTime = sortedArticles.First().ArticlePubDate - epoch;
return (long)elapsedTime.TotalSeconds;
}
else
{
return 0;
}
}
This method above is called inside an Async method, just to know.
I tried, desperately, to call .ToList() by doing :
var sortedArticles = DbContext.Articles.ToList().OrderByDescending(article => article.ArticlePubDate).ToList();
But still get the same error.
This is really frustrating, I don't know how to solve this problem, not sure what and how I should change the Default.rd.xml, any one can help telling me how to achieve this build correctly ?
Please try to add type 'Microsoft.Extensions.Caching.Memory.MemoryCacheOptions' in Default.rd.xml (already present in your project).
cf. https://blogs.msdn.microsoft.com/dotnet/2014/05/21/net-native-deep-dive-help-i-hit-a-missingmetadataexception/
For example:
<?xml version="1.0" encoding="utf-8"?>
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<Type Name="Microsoft.Extensions.Caching.Memory.MemoryCacheOptions" Dynamic="Required All" />
</Application>
</Directives>

EQATEC Profiling Error - An item with the same key has already been added

I seem to be getting this error when I try to profile a specific WP7 project using the EQATEC Profiler
* ERROR: Could not process xap-file MusicApp.xap: An item with the same key has already been added. at
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue
value, Boolean add) at Ionic.Zip.ZipFile.InternalAddEntry(String
name, ZipEntry entry) at
Ionic.Zip.ZipFile._InternalAddEntry(ZipEntry ze) at
Ionic.Zip.ZipFile.AddEntry(String entryName, Stream stream) at
Ionic.Zip.ZipFile.AddEntry(String entryName, Byte[] byteContent)
at EQATEC.AssemblyInjector.Engine.XAP.XAPPackage.Save(XAPPackage xap)
at
EQATEC.AssemblyInjector.Engine.Assembly.AssemblyScout.VisitDirectory(DirectoryInfo
inputdir, DirectoryInfo outputdir, String subpath)
EQATECProfilerEngine.ProcessApp: An item with the same key has already
been added.
Has anyone experienced this or know why this happens? Or perhaps knows a solution?
The new release 3.8.20 of EQATEC Profiler has this fixed. See the release history.
The problem would occur for WP7 or Silverlight apps if the xap-file contained the same file name more than once, maybe even using different path-separators. Here is a real example from another user's xap-file:
Images\Tiles\TileBackground.png
Images/Tiles/TileBackground.png
The profiler would try to add the same file twice to the instrumented xap-file and fail. The new 3.8.20 will now simply skip any further duplicated files. Of course, you probably didn't mean to add the same file twice to your MusicApp.xap so you should check your project for duplicate file entries.

Error during solution import in Visual Studio 2010 and when applying a web template

I'm trying to import a solution from a wsp-file into a SharePoint 2010 project in Visual Studio 2010. The solution file results from a site template I exported using the "safe as template" option of a website.
After selecting the solution file I exported and specifying the single items I want to import (I select all), Visual Studio starts to import the solution. When it finished with the last item it shows an error message saying:
The SharePoint solution import operation completed, but with errors. As a result, the project may not deploy successfully.
To check whether the import was OK or corrupted I packaged the solution again and try to redeploy it via code by creating a new website collection, uploading the solution file (packaged with Visual Studio) as an user solution (sandboxed solution) to the website collection, activating all features of the solution and applying the web template to the site collection's root website. At the point where the template is applied it takes a long time till a SPException occurs with the following message:
<nativehr>0x80131600</nativehr><nativestack></nativestack>
The inner exception's message is not really better, it says:
<nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>
StackTrace:
[COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +0
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +172
[SPException: <nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) +27257906
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +27639363
Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate) +1218
Microsoft.SharePoint.ApplicationPages.TemplatePickerUtil.ApplyWebTemplateAndRedirect(SPWeb Web, String strWebTemplate, Nullable`1 bSharedNav, Boolean bOnTopNav, Boolean bOnQuickLaunch, Page page, Boolean bDeleteOnError) +1870
Microsoft.SharePoint.ApplicationPages.TemplatePickPage.BtnSubmit_Click(Object sender, EventArgs e) +129
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
To validate that the error results from the solution import or packaging process I used the same code to create a website collection but this time using the original wsp-file which was not imported into Visual Studio and packaged again. And this time the web template can be applied without any error.
So I'm wondering what I'm doing wrong when I imported the solution into Visual Studio or when I packaged the solution again.
If you check the Visual Studio output window after the import, you'll likely see something like this in the "SharePoint Tools" output
Total number of items to import: 161
Total number of items imported successfully: 158
Total number of items not imported due to errors: 3
Then if you scroll up in the lines that are detailing what is being imported, you'll see descriptive errors of each item that failed.
In my case, it was
Importing Module: _catalogswfpubApproval - SharePoint 2010_Features\ReviewWorkflowsSPD1033...
Error occurred while importing 'Module: _catalogswfpubApproval - SharePoint 2010_Features\ReviewWorkflowsSPD1033'
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Which is clear enough.
I simply recreated the project with a project path close to the system root, and it imported successfully.

Resources