[generator] Fix reporting BI1042. (#13587)
Fix reporting BI1042 to include the type + property that triggered the error + add a test.
This commit is contained in:
Родитель
bcbb6c8438
Коммит
09f349b8ce
|
@ -6385,7 +6385,7 @@ public partial class Generator : IMemberGatherer {
|
|||
}
|
||||
} else if (BindThirdPartyLibrary) {
|
||||
// User should provide a LibraryName
|
||||
throw new BindingException (1042, true);
|
||||
throw ErrorHelper.CreateError (1042, /* Missing '[Field (LibraryName=value)]' for {0} (e.g."__Internal") */ type.FullName + "." + propertyName);
|
||||
} else {
|
||||
library_name = type.Namespace;
|
||||
}
|
||||
|
|
|
@ -129,6 +129,18 @@ namespace GeneratorTests
|
|||
bgen.AssertErrorPattern (1041, "The selector doit:with:more: on type Derived is found multiple times with different argument types on argument 2 - System.Int32 : .*Foundation.NSObject.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BI1042 ()
|
||||
{
|
||||
var bgen = new BGenTool ();
|
||||
bgen.Profile = Profile.iOS;
|
||||
bgen.AddTestApiDefinition ("bi1042.cs");
|
||||
bgen.CreateTemporaryBinding ();
|
||||
bgen.ProcessEnums = true;
|
||||
bgen.AssertExecuteError ("build");
|
||||
bgen.AssertError (1042, "Missing '[Field (LibraryName=value)]' for BindingTests.Tools.DoorOpener (e.g.\"__Internal\")");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BI1046 ()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
using Foundation;
|
||||
|
||||
namespace BindingTests
|
||||
{
|
||||
public enum Tools {
|
||||
[Field ("DoorOpener")]
|
||||
DoorOpener,
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче