public void XmlUnexpandedVariable_7904(Profile profile)
        {
            using (var bundler = new BundlerTool()) {
                var code = @"
using System;
using Foundation;
using ObjCRuntime;
class T {
    static void Main ()
	{
		Console.WriteLine (typeof (NSObject));
	}
}
";
                bundler.Profile = profile;
                bundler.CreateTemporaryCacheDirectory();
                bundler.CreateTemporaryApp(profile, code: code);
                // typo is intentional since `{ProjectDir}` should be expanded (different issue)
                bundler.CustomArguments = new [] { "--xml=${xProjectDir}/linker.xml", "-v", "-v", "-v", "-v" };
                bundler.AssertExecuteFailure();
                // {} messing with a good pattern substitution - we want to avoid an MT0000 when verbosity is applied
                bundler.AssertErrorPattern(2004, "");
                bundler.AssertErrorCount(1);
            }
        }
 public void MX0090(string target_framework, string expected_target_framework)
 {
     using (var bundler = new BundlerTool()) {
         bundler.Sdk             = BundlerTool.None;
         bundler.TargetFramework = target_framework;
         bundler.Linker          = LinkerOption.DontLink;        // This makes it possible to trigger a reliable error to shortcut mmp execution soon after showing the warning we're looking for.
         bundler.AssertExecuteFailure();
         bundler.AssertWarning(90, $"The target framework '{target_framework}' is deprecated. Use '{expected_target_framework}' instead.");
         bundler.AssertError(17, "You should provide a root assembly.");                  // We only want to test the MX0090 warning, and then stop doing stuff asap, which this error does.
         bundler.AssertWarningCount(1);
         bundler.AssertErrorCount(1);
     }
 }
        public void MX0070(string target_framework)
        {
            using (var bundler = new BundlerTool()) {
                bundler.Sdk             = BundlerTool.None;
                bundler.TargetFramework = target_framework;
#if MONOTOUCH
                bundler.Action = MTouchAction.None;
#endif
                bundler.AssertExecuteFailure();
                bundler.AssertErrorPattern(70, $"Invalid target framework: {target_framework}.*");
                bundler.AssertWarningCount(0);
                bundler.AssertErrorCount(1);
            }
        }
Exemple #4
0
        public void MX4105(Profile profile)
        {
            using (var bundler = new BundlerTool()) {
                var code = @"
using System;
using Foundation;
using ObjCRuntime;
class D : NSObject {
	[Export (""d1:"")]
	public void D1 (Delegate d)
	{
	}

	[Export (""d2:"")]
	public void D2 (MulticastDelegate d)
	{
	}

	[Export (""d3:"")]
	public void D3 (Action d)
	{
		// This should not show errors
	}

	[Export (""d4"")]
	public Delegate D4 ()
	{
		return null;
	}

	[Export (""d5"")]
	public MulticastDelegate D5 ()
	{
		return null;
	}

	[Export (""d6"")]
	public Action D6 ()
	{
		return null;
	}

	static void Main ()
	{
		Console.WriteLine (typeof (NSObject));
	}
}
";
                bundler.Profile = profile;
                bundler.CreateTemporaryCacheDirectory();
                bundler.CreateTemporaryApp(profile, code: code, extraArg: "/debug:full");
                bundler.Optimize  = new string [] { "blockliteral-setupblock" };
                bundler.Registrar = RegistrarOption.Static;
                bundler.AssertExecuteFailure();
                bundler.AssertError(4105, "The registrar cannot marshal the parameter of type `System.Delegate` in signature for method `D.D1`.");
                bundler.AssertError(4105, "The registrar cannot marshal the parameter of type `System.MulticastDelegate` in signature for method `D.D2`.");
                bundler.AssertWarning(4173, "The registrar can't compute the block signature for the delegate of type System.Delegate in the method D.D4 because System.Delegate doesn't have a specific signature.", "testApp.cs", 24);
                bundler.AssertWarning(4173, "The registrar can't compute the block signature for the delegate of type System.MulticastDelegate in the method D.D5 because System.MulticastDelegate doesn't have a specific signature.", "testApp.cs", 30);
                bundler.AssertWarning(4174, "Unable to locate the block to delegate conversion method for the method D.D3's parameter #1.", "testApp.cs", 18);
                bundler.AssertWarning(4176, "Unable to locate the delegate to block conversion type for the return value of the method D.D4.", "testApp.cs", 24);
                bundler.AssertWarning(4176, "Unable to locate the delegate to block conversion type for the return value of the method D.D5.", "testApp.cs", 30);
                bundler.AssertWarning(4176, "Unable to locate the delegate to block conversion type for the return value of the method D.D6.", "testApp.cs", 36);
                bundler.AssertErrorCount(2);
                bundler.AssertWarningCount(6);
            }
        }