Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25824

FxCopCmd.exe failed and returned 1 as exit code

      Hi guys, I have a .NET (C#) project that fails during the execution of the FxCopCmd.exe. Follow below the Jenkins log:

      ...
      [INFO] [02:30:06.361] Source encoding: UTF-8, default locale: en_US
      [INFO] [02:30:06.361] Index files
      [INFO] [02:30:06.798] 46 files indexed
      [INFO] [02:30:08.470] Quality profile for cs: ams-default-cs
      [INFO] [02:30:08.548] All ReSharper rules are disabled, skipping its execution.
      [INFO] [02:30:08.580] Sensor QProfileSensor...
      [INFO] [02:30:08.595] Sensor QProfileSensor done: 15 ms
      [INFO] [02:30:08.595] Sensor org.sonar.plugins.stylecop.StyleCopSensor@1221adc...
      [INFO] [02:30:08.673] Microsoft (R) Build Engine Version 4.0.30319.1
      [INFO] [02:30:08.673] [Microsoft .NET Framework, Version 4.0.30319.1]
      [INFO] [02:30:08.673] Copyright (C) Microsoft Corporation 2007. All rights reserved.
      [INFO] [02:30:08.673]
      [INFO] [02:30:08.720] Build started 28/11/2014 02:30:08.
      [INFO] [02:30:10.252] Project "G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\StyleCop-msbuild.proj" on node 1 (default targets).
      [INFO] [02:30:10.923] 674 violations encountered.
      [INFO] [02:30:10.923] Done Building Project "G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\StyleCop-msbuild.proj" (default targets).
      [INFO] [02:30:10.923]
      [INFO] [02:30:10.923] Build succeeded.
      [INFO] [02:30:10.923]
      [INFO] [02:30:10.923] "G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\StyleCop-msbuild.proj" (default target) (1) ->
      [INFO] [02:30:10.923] (StyleCopLaunch target) ->
      [INFO] [02:30:10.970]
      [INFO] [02:30:10.970] 674 Warning(s)
      [INFO] [02:30:10.970] 0 Error(s)
      [INFO] [02:30:10.970]
      [INFO] [02:30:10.970] Time Elapsed 00:00:02.21
      [INFO] [02:30:11.173] The import of some StyleCop issues were skipped. See DEBUG logs for details.
      [INFO] [02:30:11.173] Sensor org.sonar.plugins.stylecop.StyleCopSensor@1221adc done: 2578 ms
      [INFO] [02:30:11.173] Sensor org.sonar.plugins.csharp.squid.CSharpSquidSensor@1183f2...
      [INFO] [02:30:11.267] 46 source files to be analyzed
      [INFO] [02:30:12.033] 46/46 source files analyzed
      [INFO] [02:30:12.158] Sensor org.sonar.plugins.csharp.squid.CSharpSquidSensor@1183f2 done: 985 ms
      [INFO] [02:30:12.158] Sensor org.sonar.plugins.csharp.core.CSharpFxCopProvider$CSharpFxCopSensor@1edc066...
      [INFO] [02:30:12.158] Executing command: C:/Program Files/Microsoft Fxcop 10.0/FxCopCmd.exe /file:G:\sbs1\workspace\Projeto2\DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ruleset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /forceoutput /searchgac /aspnet
      [INFO] [02:30:13.517] Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
      [INFO] [02:30:13.517] Copyright (C) Microsoft Corporation, All Rights Reserved.
      [INFO] [02:30:13.517]
      [INFO] [02:30:13.517] Loaded aspnetconfigurationsecurityrules.dll...
      [INFO] [02:30:13.533] Loaded aspnetmvcsecurityrules.dll...
      [INFO] [02:30:13.627] Loaded aspnetsecurityrules.dll...
      [INFO] [02:30:13.689] Loaded designrules.dll...
      [INFO] [02:30:13.705] Loaded globalizationrules.dll...
      [INFO] [02:30:13.736] Loaded interoperabilityrules.dll...
      [INFO] [02:30:13.752] Loaded mobilityrules.dll...
      [INFO] [02:30:13.783] Loaded namingrules.dll...
      [INFO] [02:30:13.798] Loaded performancerules.dll...
      [INFO] [02:30:13.814] Loaded portabilityrules.dll...
      [INFO] [02:30:13.830] Loaded securityrules.dll...
      [INFO] [02:30:13.908] Loaded securitytransparencyrules.dll...
      [INFO] [02:30:13.970] Loaded usagerules.dll...
      [INFO] [02:30:15.455] Loaded DCX.ITLC.Web.dll...
      [INFO] [02:30:15.470] Initializing Introspection engine...
      [INFO] [02:30:15.595] Analyzing...
      [INFO] [02:30:15.939] Analysis Complete.
      [INFO] [02:30:15.939] * 4 total analysis engine exceptions.
      [INFO] [02:30:16.158] Writing report to G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml...
      [INFO] [02:30:16.158] Done:00:00:03.5469885
      [INFO] [02:30:16.267] FxCopCmd.exe ended with the exit code: 1
      [ERROR] The execution of "C:/Program Files/Microsoft Fxcop 10.0/FxCopCmd.exe" failed and returned 1 as exit code. See http://msdn.microsoft.com/en-us/library/bb429400(v=vs.80).aspx for details.
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 41.486 s
      [INFO] Finished at: 2014-11-28T02:30:16-03:00
      [INFO] Final Memory: 20M/144M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project projeto2: The execution of "C:/Program Files/Microsoft Fxcop 10.0/FxCopCmd.exe" failed and returned 1 as exit code. See http://msdn.microsoft.com/en-us/library/bb429400(v=vs.80).aspx for details. -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project projeto2: The execution of "C:/Program Files/Microsoft Fxcop 10.0/FxCopCmd.exe" failed and returned 1 as exit code. See http://msdn.microsoft.com/en-us/library/bb429400(v=vs.80).aspx for details.
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: org.apache.maven.plugin.MojoExecutionException: The execution of "C:/Program Files/Microsoft Fxcop 10.0/FxCopCmd.exe" failed and returned 1 as exit code. See http://msdn.microsoft.com/en-us/library/bb429400(v=vs.80).aspx for details.
      at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:42)
      at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:135)
      at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:136)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      ... 19 more
      Caused by: java.lang.IllegalStateException: The execution of "C:/Program Files/Microsoft Fxcop 10.0/FxCopCmd.exe" failed and returned 1 as exit code. See http://msdn.microsoft.com/en-us/library/bb429400(v=vs.80).aspx for details.
      at com.google.common.base.Preconditions.checkState(Preconditions.java:145)
      at org.sonar.plugins.fxcop.FxCopExecutor.execute(FxCopExecutor.java:63)
      at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:98)
      at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:86)
      at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
      at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
      at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
      at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:194)
      at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
      at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
      at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:233)
      at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
      at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:226)
      at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221)
      at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
      at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
      at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
      at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
      at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
      at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
      at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
      at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
      at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
      at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
      at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
      at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
      at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
      at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
      at org.sonar.runner.api.Runner.execute(Runner.java:100)
      at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:131)
      ... 22 more
      [ERROR]
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      Sonar analysis completed: FAILURE
      Build step 'Sonar' changed build result to FAILURE
      Build step 'Sonar' marked build as failure
      Finished: FAILURE

      If I execute the FxCopCmd.exe manually (exactly as detailed in the log above), and than "echo %errorlevel%" I see that the error code is 1. If I remove the FxCop related rules from the SonarQube Quality Profiles, the build on Jenkins is executed with success.

      Thanks for any help!

          [JENKINS-25824] FxCopCmd.exe failed and returned 1 as exit code

          sbrandhof added a comment -

          This error does not relate to Jenkins plugin. Please send an email to SonarQube user mailing-list or stackoverflow with tag #sonarqube.
          Thanks

          sbrandhof added a comment - This error does not relate to Jenkins plugin. Please send an email to SonarQube user mailing-list or stackoverflow with tag #sonarqube. Thanks

          Jammes Lee added a comment -

          Hi sbrandhof, sorry but I don't agree with your comment.

          The execution of the FxCopCmd runs fine, see below:

          C:\Program Files\Microsoft Fxcop 10.0>fxcopcmd /file:G:\sbs1\workspace\Projeto2\
          DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace\
          Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ru
          leset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /forceoutput /searchgac /aspnet
          Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
          Copyright (C) Microsoft Corporation, All Rights Reserved.

          Loaded aspnetconfigurationsecurityrules.dll...
          Loaded aspnetmvcsecurityrules.dll...
          Loaded aspnetsecurityrules.dll...
          Loaded designrules.dll...
          Loaded globalizationrules.dll...
          Loaded interoperabilityrules.dll...
          Loaded mobilityrules.dll...
          Loaded namingrules.dll...
          Loaded performancerules.dll...
          Loaded portabilityrules.dll...
          Loaded securityrules.dll...
          Loaded securitytransparencyrules.dll...
          Loaded usagerules.dll...
          Loaded DCX.ITLC.Web.dll...
          Initializing Introspection engine...
          Analyzing...
          Analysis Complete.

          • 4 total analysis engine exceptions.
            Writing report to G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.
            ITLC.Web\fxcop-report.xml...
            Done:00:00:01.6719285

          The return code for this command executin is:

          C:\Program Files\Microsoft Fxcop 10.0>echo %errorlevel%
          1

          So my point is, why Jenkins is setting the build as unsuccessfull for exceptions that are detected by Fxcop? The Fxcop execution itself is fine.

          Jammes Lee added a comment - Hi sbrandhof, sorry but I don't agree with your comment. The execution of the FxCopCmd runs fine, see below: C:\Program Files\Microsoft Fxcop 10.0>fxcopcmd / file:G:\sbs1\workspace\Projeto2\ DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace\ Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ru leset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /forceoutput /searchgac /aspnet Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86 Copyright (C) Microsoft Corporation, All Rights Reserved. Loaded aspnetconfigurationsecurityrules.dll... Loaded aspnetmvcsecurityrules.dll... Loaded aspnetsecurityrules.dll... Loaded designrules.dll... Loaded globalizationrules.dll... Loaded interoperabilityrules.dll... Loaded mobilityrules.dll... Loaded namingrules.dll... Loaded performancerules.dll... Loaded portabilityrules.dll... Loaded securityrules.dll... Loaded securitytransparencyrules.dll... Loaded usagerules.dll... Loaded DCX.ITLC.Web.dll... Initializing Introspection engine... Analyzing... Analysis Complete. 4 total analysis engine exceptions. Writing report to G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX. ITLC.Web\fxcop-report.xml... Done:00:00:01.6719285 The return code for this command executin is: C:\Program Files\Microsoft Fxcop 10.0>echo %errorlevel% 1 So my point is, why Jenkins is setting the build as unsuccessfull for exceptions that are detected by Fxcop? The Fxcop execution itself is fine.

          jammeslee It is the SonarQube C# plugin, and not Jenkins, which determined that the FxCop execution was not successful.

          To convince you, here is the code: https://github.com/SonarCommunity/sonar-fxcop-library/blob/master/src/main/java/org/sonar/plugins/fxcop/FxCopExecutor.java#L63

          FxCopCmd.exe returned 1 as exit code, which is considered as a failure.

          Please switch to the SonarQube user mailing list for further support on this subject, as this not related to Jenkins.

          Dinesh Bolkensteyn added a comment - jammeslee It is the SonarQube C# plugin, and not Jenkins, which determined that the FxCop execution was not successful. To convince you, here is the code: https://github.com/SonarCommunity/sonar-fxcop-library/blob/master/src/main/java/org/sonar/plugins/fxcop/FxCopExecutor.java#L63 FxCopCmd.exe returned 1 as exit code, which is considered as a failure. Please switch to the SonarQube user mailing list for further support on this subject, as this not related to Jenkins.

            sonarteam Sonar Team
            jammeslee Jammes Lee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: