From 9946fbd4ddbcae4c69689aa7baad81f37acbbd35 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 2 Aug 2018 11:11:02 +0200 Subject: [PATCH 1/2] [tests] Adjust the MT0137 test for mcs change in behavior. Starting with mono 5.16 mcs will now add assembly references when the assembly is only used in attributes (this was already the case for csc in both 5.14 and 5.16, so it seems to be a compatibility change). Adjust the MT0137 test accordingly. --- tests/mtouch/MTouch.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index 17ede9bf04..3b64158a59 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -1770,10 +1770,13 @@ public class B mtouch.Linker = MTouchLinker.DontLink; File.Delete (dllPath); mtouch.AlwaysShowOutput = true; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); + mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build"); + mtouch.AssertWarningPattern (136, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' referenced from '.*/testApp.exe'."); mtouch.AssertWarning (137, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null', referenced by a MyCustomAttribute attribute in 'testApp.exe'."); mtouch.AssertWarning (137, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null', referenced by a System.Diagnostics.DebuggerTypeProxyAttribute attribute in 'testApp.exe'."); - mtouch.AssertWarningCount (2); + mtouch.AssertWarningCount (3); + mtouch.AssertError (2002, "Failed to resolve assembly: 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'"); + mtouch.AssertErrorCount (1); } } From fc561b247cc0bfef0a365c4d9e27c5db26eed542 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 2 Aug 2018 11:21:28 +0200 Subject: [PATCH 2/2] [msbuild] Fix parsing of json parser errors to handle trailing periods in the error message. Fixes this test: 1) Test Failure : Xamarin.iOS.Tasks.Bug60536.TestACToolTaskCatchesJsonException ColumnNumber Expected: 2 But was: 0 --- .../Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs | 11 +++++++---- .../Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs index c0f80b2c55..40db30af34 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs @@ -390,12 +390,15 @@ namespace Xamarin.MacDev.Tasks int line = 0, column = 0; int index, endIndex; - if ((index = ex.Message.IndexOf ("At line ", StringComparison.Ordinal)) != -1) { + var message = ex.Message; + if (message.EndsWith (".", StringComparison.Ordinal)) + message = message.Substring (0, message.Length - 1); + if ((index = message.IndexOf ("At line ", StringComparison.Ordinal)) != -1) { index += "At line ".Length; - if ((endIndex = ex.Message.IndexOf (", column ", index, StringComparison.Ordinal)) != -1) { - var columnBuf = ex.Message.Substring (endIndex + ", column ".Length); - var lineBuf = ex.Message.Substring (index, endIndex - index); + if ((endIndex = message.IndexOf (", column ", index, StringComparison.Ordinal)) != -1) { + var columnBuf = message.Substring (endIndex + ", column ".Length); + var lineBuf = message.Substring (index, endIndex - index); int.TryParse (columnBuf, out column); int.TryParse (lineBuf, out line); diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs index 4d3cecea16..2feaea790b 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs @@ -71,7 +71,7 @@ namespace Xamarin.iOS.Tasks Assert.AreEqual (2, Engine.Logger.ErrorEvents[0].ColumnNumber, "ColumnNumber"); Assert.AreEqual (197, Engine.Logger.ErrorEvents[0].EndLineNumber, "EndLineNumber"); Assert.AreEqual (2, Engine.Logger.ErrorEvents[0].EndColumnNumber, "EndColumnNumber"); - Assert.AreEqual ("Unexpected character ']'. At line 197, column 2", Engine.Logger.ErrorEvents[0].Message, "Message"); + Assert.AreEqual ("Unexpected character ']'. At line 197, column 2.", Engine.Logger.ErrorEvents[0].Message, "Message"); } } }