diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 5acdfb51ec03..3ac741710e66 100644 --- a/src/bgen/Generator.cs +++ b/src/bgen/Generator.cs @@ -2440,6 +2440,8 @@ static string FindNamespace (MemberInfo item) bool IsInSupportedFramework (MemberInfo klass, PlatformName platform) { string ns = FindNamespace (klass); + if (string.IsNullOrEmpty (ns)) + return false; var list = GetFrameworkListForPlatform (platform); return list.Contains (ns.ToLower (CultureInfo.InvariantCulture)); } diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index d39b1d860b75..5cb7df715580 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -381,6 +381,21 @@ public void Bug39614 (Profile profile) bgen.AssertWarning (1103, "'FooType`1' does not live under a namespace; namespaces are a highly recommended .NET best practice"); } +#if !NET + [Ignore ("This only applies to .NET")] +#endif + [TestCase (Profile.iOS)] + public void Bug18035 (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = new BGenTool (); + bgen.Profile = profile; + bgen.AddTestApiDefinition ("bug18025.cs"); + bgen.CreateTemporaryBinding (); + bgen.AssertExecute ("build"); + bgen.AssertWarning (1103, "'FooType' does not live under a namespace; namespaces are a highly recommended .NET best practice"); + } + [Test] public void Bug40282 () { diff --git a/tests/generator/bug18025.cs b/tests/generator/bug18025.cs new file mode 100644 index 000000000000..8336ba366809 --- /dev/null +++ b/tests/generator/bug18025.cs @@ -0,0 +1,9 @@ +using System; +using Foundation; + +[BaseType (typeof (NSObject))] +public interface FooType { + [Introduced (PlatformName.iOS, 8, 0)] + [Export ("getBar:")] + string GetBar (string bar); +}