Gitlab CI pipeline SonarQube msbuild error ArgumentNullException: Value cannot be null - msbuild

Is anyone familiar with this error and how to solve it? I'm using Sonarqube Scanner 2.3.1 and msbuild 12.0. The project is 4.5 framework.
Time Elapsed 00:00:39.12
$ SonarQube.Scanner.MSBuild.exe end
SonarQube Scanner for MSBuild 2.3.1
Default properties file was found at C:\SonarQube\bin\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube\bin\SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Post-processing started.
11:00:26.108 Using environment variables to determine the download directory...
11:00:26.188 11:00:26.188 sonar.verbose=true was specified - setting the log verbosity to 'Debug'
11:00:26.191 Loading the SonarQube analysis config from F:\Gitlab-Runner\builds\1d3a7e33\1\folder\folder\folder\.sonarqube\conf\SonarQubeAnalysisConfig.xml
11:00:26.191 Not running under TeamBuild
11:00:26.191 Analysis base directory: F:\Gitlab-Runner\builds\1d3a7e33\1\folder\folder\folder\.sonarqube
Build directory:
Bin directory: F:\Gitlab-Runner\builds\1d3a7e33\1\folder\folder\folder\.sonarqube\bin
Config directory: F:\Gitlab-Runner\builds\1d3a7e33\1\folder\folder\folder\.sonarqube\conf
Output directory: F:\Gitlab-Runner\builds\1d3a7e33\1\folder\folder\folder\.sonarqube\out
Config file: F:\Gitlab-Runner\builds\1d3a7e33\1\folder\folder\folder\.sonarqube\conf\SonarQubeAnalysisConfig.xml
Generating SonarQube project properties file to F:\Gitlab-Runner\builds\1d3a7e33\1\folder\folder\folder\.sonarqube\out\sonar-project.properties
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: key
at SonarQube.Common.ListPropertiesProvider.TryGetProperty(String key, Property& property)
at SonarQube.Common.AggregatePropertiesProvider.TryGetProperty(String key, Property& property)
at SonarQube.Common.AggregatePropertiesProvider.GetAllProperties()
at SonarScanner.Shim.PropertiesFileGenerator.GetAnalysisProperties(AnalysisConfig config)
at SonarScanner.Shim.PropertiesFileGenerator.GenerateFile(AnalysisConfig config, ILogger logger, IRoslynV1SarifFixer fixer)
at SonarScanner.Shim.SonarScannerWrapper.Execute(AnalysisConfig config, IEnumerable`1 userCmdLineArguments, ILogger logger)
at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.InvokeSonarScanner(IAnalysisPropertyProvider cmdLineArgs, AnalysisConfig config)
at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.Execute(String[] args, AnalysisConfig config, ITeamBuildSettings settings)
at SonarQube.Bootstrapper.BootstrapperClass.PostProcess()
at SonarQube.Bootstrapper.BootstrapperClass.Execute()
at SonarQube.Bootstrapper.Program.Execute(String[] args, ILogger logger)
at SonarQube.Bootstrapper.Program.Main(String[] args)
ERROR: Job failed: exit status 3762504530

The problem is caused by the property called sonar.analysis.mode being set equal to "issues".
issues mode should never be used manually as it is used only by tools.
set your sonar.analysis.mode=[preview/publish]
(publish is default so you don't have to set the property at all if that's what you want.)

Related

Error while Building (compile) wixproj using MSBuild api 15.9.20

I'm using wix in a project and i have a specific need :
Build wixproj using MSBuild from c#.
For that i'm using MSBuild api as folowing :
static void Main(string[] args)
{
string toolsPath = ToolLocationHelper.GetPathToBuildToolsFile("msbuild.exe", ToolLocationHelper.CurrentToolsVersion);
ProjectCollection projectCollection = new ProjectCollection();
projectCollection.AddToolset(new Toolset(ToolLocationHelper.CurrentToolsVersion, Path.GetDirectoryName(toolsPath), projectCollection, string.Empty));
Project project = projectCollection.LoadProject("TestWix.wixproj");
var result = project.Build(new ConsoleLogger());
Console.ReadKey();
}
And i get this error :
C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets(1988,5): error MSB4127: The "GenerateCompileWithObjectPath" task could not be instantiated from the assembly "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixTasks.dll". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.Tools.WindowsInstallerXml.Build.Tasks.GenerateCompileWithObjectPath' to type 'Microsoft.Build.Framework.ITask'.
But when i use msbuild command line it's work fine.
Do you have any idea please ?
Thank you in advance.

Ignite configuration with absolute path

I downloaded Ignite 2.5.0 (I use maven dependences in Eclipse on a Mac for my Java class), and I tried to start Ignite with a configuration file given with an absolute path:
public static void main(String [] args) throws Exception {
try (Ignite ignite = Ignition.start("/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml")) {}
}
but I got exception:
Exception in thread "main" class org.apache.ignite.IgniteException: Failed to find configuration in: file:/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:990)
at org.apache.ignite.Ignition.start(Ignition.java:355)
at hu.sztaki.lpds.ml.ignite.WekaIgnite.main(WekaIgnite.java:82)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to find configuration in: file:/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:116)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)
at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:744)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:945)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:854)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:724)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:693)
at org.apache.ignite.Ignition.start(Ignition.java:352)
... 1 more
The config file is there:
$ cat /Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
<?xml version="1.0" encoding="UTF-8"?>...
and:
new File("/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml").exists() is true
According to docs this path can be absolute.
What am I doing wrong?
Thank you.
I think, the problem is that default-config.xml file has only abstract IgniteConfiguration. This is the case in the default configuration file in examples.
Check, if the configuration bean's definition has abstract=true parameter, and remove it if it does.
P.S.
Creating Ignite as a resource of a try block is a pretty bad idea, since the node will stop right after execution of the try block is finished.

SonarQube MSBuild Runner and TFS 2013 in VisualStudio Remote server returns unauthorized

I have edited a build definition from TFS 2013 inside of Visual Studio following the steps from Setup of the MSBuild SonarQube Runner on the Build Agent Machine and Install the SonarQube Scanner for MSBuild. I am getting the exact same errors as the question from this post as well as one that reads:
Exception Message: TF270015: 'MSBuild.SonarQube.Runner.exe' returned an unexpected exit code. Expected '0'; actual '255'. See the build logs for more details. (type UnexpectedExitCodeException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I've updated the SonarQube.Analysis.xml file with the correct information and followed the steps of the aforementioned post, updating the Global Permissions for Execute Analysis inside of SonarQube. I have tried updating IIS AppPool info for the service I am trying to build as well as updating Network Service access permissions, but to no avail. Anyone's advice is greatly appreciated!

Visual Studio Team Services sends "build failed" email when build succeeds

We're using Visual Studio Team Services for a project, and because we want to use continuous integration I set it up to build on each check-in, and to notify me when a build fails. Now, every time someone checks in code, I get an email that tells me the build failed:
Summary
Debug | Any CPU
3 error(s), 0 warning(s)
$/Foo/Bar.Foo/Bar.Foo.sln - 3 error(s), 0
warning(s)
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets
(126): The Dnx Runtime package needs to be installed. See output
window for more details.
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets
(126): The Dnx Runtime package needs to be installed. See output
window for more details.
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets
(126): The Dnx Runtime package needs to be installed. See output
window for more details.
Other Errors
1 error(s)
Exception Message:
MSBuild error 1 has ended this build. You can find more specific
information about the cause of this error in above messages. (type
BuildProcessTerminateException) Exception Stack Trace: at
System.Activities.Statements.Throw.Execute(CodeActivityContext
context) at
System.Activities.CodeActivity.InternalExecute(ActivityInstance
instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at
System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
executor, BookmarkManager bookmarkManager, Location resultLocation)
When I go to visualstudio.com to check out the completed builds, the build in question is listed as "Succeeded". When I check the logs, everything is fine, and when I get a latest version and build locally, it also builds.
If I go to the "alerts" tab on the administration panel, I have one alert specified, with the following filters:
Team Project = [Current project]
AND Status = Failed
What's going on here?
I cannot say if it is safe to delete it since you don't know where it came from. And if you want to edit a XAML build definition, you need to do it from "Visual Studio\Team Explorer\Builds\XAML Build Definitions":
However, before you figure out if the XAML definition can be deleted, you can add one more filter in alert to set the alert to only track the build definition you want:

Wix light.exe : error LGHT0001: The system cannot open the device or file specified.

Today we build our product with MSBuild /m to build with multiprocess.
Before we do a change to heat some files in pre-build event, build with MSBuild multiprocess can be success.
Now build is failed with following exception:
124>light.exe : error LGHT0001: The system cannot open the device or file specified. (Exception from HRESULT: 0x8007006E) [...MSI.wixproj]
Exception Type: System.IO.FileLoadException
Stack Trace:
at Microsoft.Tools.WindowsInstallerXml.MergeMod.IMsmMerge2.OpenModule(String fileName, Int16 language)
at Microsoft.Tools.WindowsInstallerXml.Binder.MergeModules(String tempDatabaseFile, Output output, FileRowCollection fileRows, StringCollection suppressedTableNames)
at Microsoft.Tools.WindowsInstallerXml.Binder.BindDatabase(Output output, String databaseFile)
at Microsoft.Tools.WindowsInstallerXml.Binder.Bind(Output output, String file)
at Microsoft.Tools.WindowsInstallerXml.Tools.Light.Run(String[] args)
(Link target) ->
light.exe : error LGHT0001: The system cannot open the device or file specified. (Exception from HRESULT: 0x8007006E) [...Msi.wixproj]
using Wix 3.8
After investigation with team, we find out root cause.
ProductMSI.sln has more than 50 MSI wix projects and all shared MSM projects to build.
Each MSI project has a post build event action that it will reopen MSI related MSM to do some change to MSI by WindowsInstaller API as DataBase. And it opens MSM as read&edit mode by API.
So if one shared MSM is opened by one MSI post event and will be opened by another wix project to compile. Open request will be denied. The above error will be thrown.
Solution:
1.Change post event action to open MSM as read-only, instead of read&edit mode.
We test it pass.