Bug 33896 - Build fails if LANG is set to a UTF8 locale
Summary: Build fails if LANG is set to a UTF8 locale
Status: NEW
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model (show other bugs)
Version: 5.9
Hardware: PC Linux
: Normal normal
Target Milestone: master
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-09-11 14:35 UTC by Kai Bösefeldt
Modified: 2016-10-04 14:49 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 33896 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Kai Bösefeldt 2015-09-11 14:35:43 UTC
I normally have set the LANG environment variable to de_DE.utf8. However, this makes MonoDevelop (5.9.6 under Manjaro Linux 15.09) unable to start MSBuild process. Triggering a compilation yields the following error message in the build log:

Build failed. MSBuild process could not be started

I also see other strange behavior, e.g. "using System.Linq" higlighted red, although all assembly references are OK.

After some investigation, I found out, that the problem seems to be the Byte Order Mark (BOM), which is automatically generated for stdout and stderr in some cases and seems to be a problem for some inter process communications, as they redirect the stream output of a process and parse it, but don't expect the BOM at the beginning.

If I change the locale to de_DE (without .utf8), everything is OK. This is my current workaround.

I wrote the following simple code (with some copies from MonoDevelop code) to investigate the problem. You may find is useful or ignore it:

using System;
using System.Linq;
using System.Diagnostics;
using System.Threading;

class P
{
  public static void Main(string[] args)
  {
    string responseKey = "[MonoDevelop]";
    var exe = "/usr/lib/monodevelop/bin/MSBuild/4.0/MonoDevelop.Projects.Formats.MSBuild.exe";
    var pinfo = new ProcessStartInfo (exe)
    {
      UseShellExecute = false,
      CreateNoWindow = true,
      RedirectStandardError = true,
      RedirectStandardInput = true
    };

    var process = new Process { StartInfo = pinfo };

    Console.WriteLine("Starting process " + pinfo.FileName);
    process.Start();

    process.BeginErrorReadLine();
    process.ErrorDataReceived += (sender, e) =>
    {
      Console.WriteLine("Received error: {0}", e.Data ?? "<null>");
      if (e.Data == null) return;
      if (e.Data.StartsWith(responseKey, StringComparison.Ordinal))
        Console.WriteLine("Response Key found!");
      else
      {
        Console.WriteLine(string.Join(" ", from c in e.Data.Take(responseKey.Length) select ((int)c).ToString("X")));
        if (e.Data.Substring(1).StartsWith(responseKey, StringComparison.Ordinal))
          Console.WriteLine("Response Key found at position 1!");
      }
    };

    process.StandardInput.WriteLine("0");

    Console.WriteLine("Waiting for finish");
    process.WaitForExit();
    Console.WriteLine("Finished");
  }
}