Recipe for running InspectCode against a Xamarin.iOS solution in a CI pipeline

What is the best/expected way to run InspectCode against a Xamarin.iOS solution in a CI pipeline?  We user Azure DevOps for our CI pipelines.

We have quite a large code base with a Xamarin.iOS solution.  Historically, before the cross platform global tools were around, we'd build our .net framework unit test project on a Windows agent and then have the command line tool do the inspection.  I don't recall if this would actually inspect the iOS specific projects and related files.  But I'm guessing it would be better to do the build on a Mac so you could build the entire solution.

We've since moved to using JetBrains.ReSharper.GlobalTools and I'm trying to get this running on a Mac CI build agent.  As of 2021.2 it looks like inspect code forces a build unless you opt out. 

For my first attempt, my command line looks something like this:

jb inspectcode --disable-settings-layers:SolutionPersonal --properties:"Platform=iPhoneSimulator;Configuration=Debug"  -o="/Users/runner/work/1/a/InspectionResults" --exclude="*.dll;*.pdf;*.jpg;*.jpeg;*.png;*.strings;*.storyboard" --toolset-path="/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin/MSBuild.dll" "src/MySolution.sln"

Using this, I see a few warning about not being able to file code file paths, but ultimately it seems the NuGet package restore never completes.  Note, my pipeline is setup to use Nuget 5.9.0 and does use an authenticated, private NuGet feed.  The pipeline is configured to use this private NuGet feed.

00:01:01 Restoring NuGet Packages
00:02:01 Restoring NuGet Packages
00:03:01 Restoring NuGet Packages
.
.
00:59:02 Restoring NuGet Packages
 
For my second attempt I had my pipeline restore the nuget packages before invoking inspect code.  I used the same inspect code command line as in my first attempt.
jb inspectcode --disable-settings-layers:SolutionPersonal --properties:"Platform=iPhoneSimulator;Configuration=Debug" -o="/Users/runner/work/1/a/InspectionResults" --exclude="*.dll;*.pdf;*.jpg;*.jpeg;*.png;*.strings;*.storyboard" --toolset-path="/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin/MSBuild.dll" "src/MySolution.sln"

Like my first attempt, I see a few warning about not being able to file code file paths, but ultimately it seems the NuGet package restore never completes.

00:01:01 Restoring NuGet Packages
00:02:01 Restoring NuGet Packages
00:03:01 Restoring NuGet Packages
.
.
00:59:02 Restoring NuGet Packages

In my third attempt, I have my pipeline perform the build and tell inspectCode to not build the solution.  
jb inspectcode --no-build --disable-settings-layers:SolutionPersonal --properties:"Platform=iPhoneSimulator;Configuration=Debug" -o="/Users/runner/work/1/a/InspectionResults" --exclude="*.dll;*.pdf;*.jpg;*.jpeg;*.png;*.strings;*.storyboard" --toolset-path="/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin/MSBuild.dll" "src/MySolution.sln"

I don't know the inspection implications of pre-building, but it appears to be the most successful.  The problem is about 50% of the time the inspections complete, but it appears inspectCode doesn't return so the CI step hangs and eventually times out.

Any insight into the best path here would be greatly appreciated.

3 comments
Comment actions Permalink
Official comment

Andy C

inspectcode on non-windows environment is tested only with .NET Core MsBuild.
So, if for you with mono the third case with explicit building works better - that fine, use it.
What about hanging - please, file a ticket on youtrack with debug logging.

Comment actions Permalink

Thanks Slava.  To be clear, are you asking for "verbose" or "trace" logging?

0

Please sign in to leave a comment.