The error
Error 102 Code Analysis detected errors. See Code Analysis results window or log file for details. KickOffTitan
Code Analysis results window
CA0001 Error Running Code Analysis
CA0001 : The following error was encountered while reading module 'KickOffTitan':
Method type parameter in position 0 is not valid.
[Errors and Warnings] (Global)
I have some inkling that this might have to do with using vs2012 + .net 4.0 + Microsoft.Bcl.Async
If I remove async/await but leave in TaskEx
I get many Method type parameter in position 0 is not valid and 1
CA0001 Error Running Code Analysis CA0001 : Could not resolve reference to System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. [Errors and Warnings] (Global)
If i remove any stuff from async package(async/await/TaskEx) it compiles
Related
I am attempting to use AddictedCS SoundFingerprinting (https://github.com/AddictedCS/soundfingerprinting).
When I download any recent version and build with Visual Studio 2019 I get the expected output with no errors or warnings (SoundFingerprinting.dll).
The issue is that when I attempt to call functionality from the DLL in a .net console application I get errors relating to netstandard referencing.
I've attempted to add a new reference manually as the error message suggests, but get no further - same error occurs.
Here is my code, taken straight from the SoundFingerprinting example:
var hashedFingerprints = await FingerprintCommandBuilder.Instance
.BuildFingerprintCommand()
.From("C:/Users/Asher/Desktop/testSound.wav")
.UsingServices(audioService)
.Hash();
Here is the error log I am getting when compiling my console app with either mcs or csc:
C:\Users\Asher\Desktop\Raw_0.1>mcs TestProg.cs
-r:SoundFingerprinting.dll -r:protobuf-net.dll TestProg.cs(46,40): error CS0012: The type System.Object' is defined in an assembly that
is not referenced. Consider adding a reference to assembly
netstandard, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'
C:\Users\Asher\Desktop\Raw_0.1\SoundFingerprinting.dll (Location of
the symbol related to previous error) Compilation failed: 1 error(s),
0 warnings
I attempted this on my desktop PC running Windows 10, and on my Surface Pro 6 running Windows 10. I also attempted this using VS2017. The result was the same each time.
Also tried to use the library in Unity3D which caused a crash with no prompt or stacktrace output.
To Reproduce
Use: Windows 10, Visual Studio 2019
Steps to reproduce the behavior:
Download latest release (v7.2.0-beta3)
Build libraries
Attempt to call functionality from SoundFingerprinting.dll via a console application
I encountered exactly the same problem today. What fixed it for me was simply downloading the latest version of protobuf-net from nuget:
Install-Package protobuf-net -Version 3.0.101
Also, please don't paste pictures of code but the code itself next time.
I am running a team city build, which is failing continuously because of FXCope unable to resolve the reference.
Getting following error:
The following error was encountered while reading module 'project': Could not resolve member reference: [dllNamespace, Version=1.0.0.238, Culture=neutral, PublicKeyToken=null]dllNamespace.IoC::Setup.
The actual version of the dll is 1.0.0.238 and it is present in the teamcity build and all my tests are getting passed but at the end of the build Fxcope throw the above error.
I'm struggling with the following situation:
There is a bunch of projects (14 to be precise) in a VS2012 solution.
These projects are free from Code Analysis warnings and errors.
I would like to use the CodeAnalysisTreatWarningsAsErrors switch for our build server, so the build fails in case there are any CA issues. This is accomplished by setting the environment variable "CodeAnalysisTreatWarningsAsErrors" to "true". This flag is consumed by Code Analysis as parameter (see C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\CodeAnalysis\Microsoft.CodeAnalysis.Targets).
When building the solution from FinalBuilder (on the build server or on my machine) or from command line (through devenv.com), VS2012 output tells me that there are no Code Analysis warnings and no errors at all - but the build fails with no further reason.
I isolated the problem to the following pieces:
it is one single project that causes the fail. If i delete its binaries, the error can always be reproduced (this project uses the exact same .targets files and other environment stuff as the other projects)
if I set CodeAnalysisTreatWarningsAsErrors to false, the build succeeds (again, with 0 warnings and 0 errors).
The output from VS2012 is pretty poor and (according to my researches) there is no way to increase the verbosity level for devenv.com.
It looks like this:
1>------ Skipped Build: Project: xxxxxx_Test, Configuration: Debug x64 ------
1>Project not selected to build for this solution configuration
2>------ Build started: Project: xxxx.xxxx.Modules.Base, Configuration: Debug x64 ------
2> xxxx.xxxx.Modules.Base -> X:\xxx\x64\Debug\xxxx.xxxx.Modules.Base.dll
2> Running Code Analysis...
2> Code Analysis Complete -- 0 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 12 up-to-date, 1 skipped ==========
FinalBuilder adds the return value:
devenv.com returned Error code : 1
Does anybody have any ideas what could cause the build to fail only when setting CodeAnalysisTreatWarningsAsErrors to true although there are no warnings and errors at all?
Resolved the problem:
That line of MSBuild-output made me curious and finally led to the right place:
The indirectly-referenced assembly '...dll' could not be found. This assembly is not required for analysis, however, analysis results could be incomplete. This assembly was referenced by: ...dll
Indeed, there was an assembly of third-party software that did not match the referenced version.
Obviously, that did not produce any error or warning at all, but, when activating CodeAnalysisTreatWarningsAsErrors, Code Analysis thought it's better to return with an error.
So, the solution was to (temporarily) use MSBuild with different verbosity-levels ('diagnostic' was too much, 'detailed' gave me still about 29.800 lines for code analysis of that single assembly-project, including the missing assembly name), digging through that stuff and finding the needle in the haystack...
Thanks to dario_ramos for pointing me towards the right direction!
I downloaded a few source codes containing C# code that uses windows forms. Is it possible to compile the codes under the Linux environment (Ubuntu 12.04) and run it?
I already tried successfully to compile a few C# source codes with mcs and run the resulting exe file with mono.
The source codes can be downloaded here. If it's possible please describe how would you compile and run chapter 2/OpeningDocument solution.
$ mcs Program.cs
Program.cs(3,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
EDIT
$ gmcs -pkg:dotnet Program.cs
Program.cs(17,33): error CS0246: The type or namespace name `Form1' could not be found. Are you missing a using directive or an assembly reference?
Program.cs(17,25): error CS1502: The best overloaded method match for `System.Windows.Forms.Application.Run(System.Windows.Forms.Form)' has some invalid arguments
/usr/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll (Location of the symbol related to previous error)
Program.cs(17,25): error CS1503: Argument `#1' cannot convert `object' expression to type `System.Windows.Forms.Form'
Compilation failed: 3 error(s), 0 warnings
If you're not using the latest version of Mono, this should work:
gmcs -pkg:dotnet *.cs
The latest version of mono uses mcs instead of gmcs. In the previous ones, mcs targets .NET 1.1.
You may wish to run your code against the mono migration analyser to see what fails or isn't supported. You can find the tool here: http://www.mono-project.com/MoMA. NOTE For the tool to work you will need access to a windows machine.
You can also take a look at current mono compatibility with various .Net features at http://www.mono-project.com/Compatibility.
Specifically for windows forms see: http://www.mono-project.com/WinForms
Hope this helps.
Here's the error I'm getting:
Error CS0016: Could not write to file Fact.Apprentice.Core', cause: Type '<>__AnonType02' was not completed. (CS0016) (Fact.Apprentice.Core - Mono)
If I compile using MonoDevelop + Microsoft .NET, no such error shows up. When using Mono framework, I am unable to compile because of this. Behavior identical for Mac or PC installation.
This kind of error usually indicates compiler bug. The most likely source will be some of your LINQ queries. You could also try Mono 2.11 which should give you better error message.