Error analyzing c# project with Sonar 4.5.4 - c#

I got the following error when analyzing a c# project with SonarQube 4.5.4. I have the sonar-csharp-plugin-4.0 installed.
Sensor org.sonar.plugins.csharp.CSharpSensor#18cf794...
10:48:17.000 DEBUG - Updating semaphore batch-com.test.sample
10:48:24.571 ERROR -
10:48:24.879 ERROR - Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
10:48:24.879 ERROR - at SonarQube.CSharp.CodeAnalysis.Runner.Program.Main(String[] args)
10:48:27.146 DEBUG - Updating semaphore batch-com.test.sample
10:48:37.211 DEBUG - Updating semaphore batch-com.test.sample
10:48:37.714 DEBUG - Release semaphore on project : org.sonar.api.resources.Project#494546[id=1442,key=com.test.sample,qualifier=TRK], with key batch-com.test.sample

The C# plugin is implemented in C# itself (based on Roslyn) since version 4.0.
It requires the .NET framework 4.5 to be installed on the machine from which the analysis is being executed.

Related

Why does using System.Data.Sqlite raise exception Could not load file or assembly 'netstandard, Version=2.1.0.0

I am writing a C# program in Visual Studio 2019 (Windows 10, .Net 4.72). My program uses System.Data.Sqlite. I just copied all the source files from an earlier Windows 7 machine, got it to compile and run, but then I ended up with this message as soon as I reached a line of code that established an SQLConnection:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in ABC.exe
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
The program '[4108] ABC.exe' has exited with code -1 (0xffffffff).
I did not use any of the dll's from the previous installation - rather, I used NuGet to download the up-to-date ones. I also downloaded NETStandard.Library.Ref (which contains NetStandard.dll Version 2.1), but it did not work when I tried to install it.
I would use .net 5 or 6, but my program needs a media player, which doesn't seem to be in .Net Core.
Any thoughts would be greatly appreciated.

System.IO.FileNotFoundException Error while refrencing a .net standard library inside a .net framework project

I'm getting System.IO.FileNotFoundException error while trying to add a .net standard library into .net framework project's references.
I have created a .net standard project which contains some other .net standard nuggets in its references, and it's output is a dll which I have inserted it as a reference in a .net framework library (actually it is a unit test project for it). But as I told before it always show me this error:
Message: Test method xDetector.Test.IntegreatedTest.TestMethod threw
exception: System.IO.FileNotFoundException: Could not load file or
assembly 'xFramework.NetCore.xDetector, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.
I have try several ways like editing cproj file and adding other changing visual studio version (which currently is 2019) but no success.
Where the problem may come from?

How to reference a .NET Core assembly in a .NET Framework application?

I have a .NET Framework 4.6.1 console application and I am attempting to reference a .NET Core 2.0 assembly within it. Visual Studio lets me setup the reference, Intellisense seems OK with the classes and methods within the .NET Core assembly but it fails to run.
If I debug the app in Visual Studio, VS shows me this message:
The application is in break mode
Your app has entered a break state, but no code is currently executing
that is supported by the selected debug engine (e.g. only native
runtime code is executing).
If I start without debugging, I get this exception:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at MyProject.Program.Main(String[] args)
Not sure what to make of this. I think I'm looking for an answer similar to this one but updated since this question is over 2 years old and the answer is no longer relevant to the current state of .NET Core.

wpf: getting exception while adding "CrystalReportsViewer" control from Toolbox

I have installed "Crystal Report (Service Pack 20)" for visual studio 2015. Whenever i drag "CrystalReportsViewer" from toolbox to WPF window and run the program i get an exception error saying " Additional information: The invocation of the constructor on type 'SAPBusinessObjects.WPF.Viewer.ViewerCore' that matches the specified binding constraints threw an exception. "
The inner exception of the above exception is
The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw
an exception.
again the inner exception of the above exception is
Could not load file or assembly 'log4net, Version=1.2.10.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. The system cannot find the file specified.":"log4net,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
i have installed 32 bit and then 64 bit for checking compatibility issues but this did not solve the problem.
1st. the runtime have to be the same of the project, no the SO's version.
2nd. when you generate the project, exclude the .dll's (CrystalReports and CrystalDecisions)
3rd. You have to copy 'log4net.dll' to the next directory: C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet.
**You have to search 'log4net.dll' in the web. I had a old link and it's not working anymore.

Affdex .NET SDK - Could not load file or assembly Affdex or one of its dependencies

I'm having error when running WPF application with reference to C:\Program Files\Affectiva\Affdex SDK\bin\release\Affdex.dll
Exception:
Could not load file or assembly 'Affdex, Version=3.1.1.419, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."
The WPF application is running under .Net Framework 4.5 and I'm running SDK version downloaded as AffdexSDK-3.1.1-419-win64.exe
According to this Affdex.dll depends on affdex-native.dll and loads it in runtime. Make sure that the latter is accessible to your program by adding it to your %PATH% variable or by adding it to your visual studio project. See example in AffdexMe source code.

Categories