\s*
(?<message>.*)$";
+ static readonly Regex RelatedSymbolsRegex = new Regex(
+ @"
+ \(Location\ of\ the\ symbol\ related\ to\ previous\ (warning|error)\)
+ ",
+ RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace);
+
private static CompilerError CreateErrorFromString(string error_string)
{
if (error_string.StartsWith ("BETA"))
Regex reg = new Regex (ErrorRegexPattern, RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace);
Match match=reg.Match(error_string);
if (!match.Success) {
- // We had some sort of runtime crash
- error.ErrorText = error_string;
- error.IsWarning = false;
- error.ErrorNumber = "";
- return error;
+ match = RelatedSymbolsRegex.Match (error_string);
+ if (!match.Success) {
+ // We had some sort of runtime crash
+ error.ErrorText = error_string;
+ error.IsWarning = false;
+ error.ErrorNumber = "";
+ return error;
+ } else {
+ // This line is a continuation of previous warning of error
+ return null;
+ }
}
if (String.Empty != match.Result("${file}"))
error.FileName=match.Result("${file}");
private static readonly string _sourceLibrary1 = "public class Test1 {}";
private static readonly string _sourceLibrary2 = "public class Test2 {}";
+ private static readonly string _sourceLibrary3 =
+ @"public class Test3 { public void F() { } }
+ public class Test4 : Test3 { public void F() { } }";
private static readonly string _sourceExecutable = "public class Program { static void Main () { } }";
[SetUp]
Assert.AreEqual (tempFile, tempFiles[0], "#4");
}
+ [Test]
+ public void MultiLineWarningIsReportedAsOneWarning()
+ {
+ CompilerParameters options = new CompilerParameters ();
+ options.GenerateExecutable = false;
+ options.GenerateInMemory = true;
+ options.TempFiles = new TempFileCollection (_tempDir);
+
+ ICodeCompiler compiler = _codeProvider.CreateCompiler ();
+ CompilerResults results = compiler.CompileAssemblyFromSource (options,
+ _sourceLibrary3);
+
+ // verify compilation was successful
+ AssertCompileResults (results, true);
+ }
+
private static string CreateTempDirectory ()
{
// create a uniquely named zero-byte file