Skip to content

Diagnosis

Rolf Bjarne Kvinge edited this page Sep 12, 2023 · 10 revisions

Build logs

The preferred way to provide a build log, is to get a binary build log.

Binary build logs

Command line

For a Xamarin.iOS or a Xamarin.Mac project, build the project (or solution) with msbuild, and pass the /bl argument:

msbuild myproject.csproj /bl:msbuild.binlog

For a .NET project, build using dotnet build instead, but the arguments are just the same:

dotnet build myproject.csproj /bl:msbuild.binlog

This will produce a msbuild.binlog file we can use to diagnose build problems.

Note that GitHub doesn't allow uploading *.binlog files directly, so they will have to be zipped first (don't just change the extension) before they're uploaded to issues.

Visual Studio for Mac

  1. Install the Project System Tools for Visual Studio for Mac extension (the installation instructions are at the very bottom of the page).
  2. Open the Build Logging pad.
  3. Start recording by clicking the play button in the Build Logging pad.
  4. Build the project.
  5. Right-click the build log in the Build Logging pad, select Open Binary Log File. This will open the binary log in Visual Studio for Mac, and the path to the binary log will be at the very top (a temporary path, `/var/folders/...).

Visual Studio (for Windows)

There are two ways to get binary build logs from Visual Studio on Windows. The preferred way is to set the MSBUILDDEBUGENGINE environment variable to 1 and then launch Visual Studio with this variable set. This approach is explained more in detail here: https://aka.ms/binlog#capturing-binary-logs-through-visual-studio.

The second option, which might be somewhat easier to do, but unfortunately produces worse build logs (not as complete) is to install a Visual Studio extension:

  1. Install the Project System Tools extension.
  2. Follow the instructions to save a *.binlog to disk.
  3. Go to "Tools -> Options", navigate to the "Projects and Solutions/Build and Run" options, and set both MSBuild project build output verbosity and MSBuild project build log file verbosity to "Diagnostic":

Build verbosity in Visual Studio

A third alternative is to build from the command line (which will get as detailed build log as the first option). Here's how to build a project from the command line on Windows: https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/windows/connecting-to-mac/#build-ios-apps-from-the-windows-command-line. The downside of this approach is that there are some issues that only occur from within Visual Studio, and thus won't reproduce from the command line.

View binary build logs

If you want to have a look at the binary build log yourself, you can do so here: https://live.msbuildlog.com/

Diagnostic build logs

If it's not possible to get a binary build log, a diagnostic (text) build log could also be provided.

Visual Studio for Mac

  1. Add -v -v -v -v to the additional mtouch arguments in the project's iOS Build options.
  2. Set the log verbosity to diagnostic in Preferences > Projects > Build.
  3. Build the project.
  4. Select all the output in the Build Output pad, and save it to disk.
  5. Upload the build log as a file (do not paste the text into an issue).

Visual Studio

  1. Add -v -v -v -v to the additional mtouch arguments in the project's iOS Build options (found by right-clicking the project in the solution explorer and selecting Properties)
  2. Set the log verbosity to diagnostic in Tools > Options > Projects and Solutions > Build and Run.
  3. Build the project.
  4. Select all the output in the Build Output pad, and save it to disk.
  5. Upload the build log as a file (do not paste the text into an issue).

Crash reports

Crash reports for macOS, Mac Catalyst and apps in the simulator can be found in the ~/Library/Logs/DiagnosticReports directory.

Crash reports for devices (iOS, tvOS, watchOS), can be downloaded from Xcode.

Open the menu Window -> Devices and Simulators, select the device on the left, and click on View Device Logs:

Crash reports in Xcode

Then Xcode will download crash reports from that device (this may take a few seconds) and list them all.

Device logs

The device log for devices can be viewed in the Console app: https://support.apple.com/en-in/guide/console/cnsl1012/mac.

Version information

How to get version information

Visual Studio for Mac

Open menu Visual Studio -> About Visual Studio > Show Details [button] > Copy Information [button].

About VS Mac

Visual Studio (for Windows)

Open menu Help > About Microsoft Visual Studio > Copy Info [button].

Clone this wiki locally