[tests][xtro] Fix NSUrl-based categories (#9034)

We were using the managed name, e.g. `NSUrl`, instead of the native name,
e.g. `NSURL`, when dealing with categories.

To fix this we must resolve the type and this caused issues as other
assemblies (e.g. OpenTK) were not already loaded/cached and some type
could not be resolved (and this throw exceptions)

The runner now loads all assemblies before starting to visit them.

The fix solved a known issue (iOS-NetworkExtension.ignore), some API
that were already bound (common-Foundation.ignore) and also caught an
additional API where we missed a `[NullAllowed]` on a return value
This commit is contained in:
monojenkins 2020-07-08 13:23:43 -04:00 коммит произвёл GitHub
Родитель de306cd96d
Коммит 9c8d1cc5f2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 25 добавлений и 16 удалений

Просмотреть файл

@ -6239,6 +6239,7 @@ namespace Foundation
[Mac (10,10), iOS (8,0)]
[Export ("promisedItemResourceValuesForKeys:error:")]
[return: NullAllowed]
NSDictionary GetPromisedItemResourceValues (NSString [] keys, out NSError error);
}

Просмотреть файл

@ -251,7 +251,7 @@ namespace Extrospection {
// static types, e.g. categories, won't have a [Register] attribute
if (type.IsStatic ()) {
if (self.HasParameters)
tname = self.Parameters [0].ParameterType.Name; // extension method
tname = self.Parameters [0].ParameterType.Resolve ().GetName (); // extension method
}
if (tname == null)
return null;

Просмотреть файл

@ -44,6 +44,7 @@ namespace Extrospection {
Helpers.Platform = Platforms.tvOS;
managed_reader.Load (assemblyName);
}
managed_reader.Process ();
var reader = new AstReader ();
foreach (var v in managed_reader) {
@ -62,17 +63,30 @@ namespace Extrospection {
class AssemblyReader : IEnumerable<BaseVisitor> {
HashSet<AssemblyDefinition> assemblies = new HashSet<AssemblyDefinition> ();
DefaultAssemblyResolver resolver = new DefaultAssemblyResolver ();
public void Load (string filename)
{
var ad = AssemblyDefinition.ReadAssembly (filename);
foreach (var v in Visitors) {
v.VisitManagedAssembly (ad);
foreach (var module in ad.Modules) {
v.VisitManagedModule (module);
if (!module.HasTypes)
continue;
foreach (var td in module.Types)
ProcessType (v, td);
resolver.AddSearchDirectory (Path.GetDirectoryName (filename));
ReaderParameters rp = new ReaderParameters () {
AssemblyResolver = resolver
};
assemblies.Add (AssemblyDefinition.ReadAssembly (filename, rp));
}
public void Process ()
{
foreach (var ad in assemblies) {
foreach (var v in Visitors) {
v.VisitManagedAssembly (ad);
foreach (var module in ad.Modules) {
v.VisitManagedModule (module);
if (!module.HasTypes)
continue;
foreach (var td in module.Types)
ProcessType (v, td);
}
}
}
}

Просмотреть файл

@ -809,14 +809,11 @@
!missing-selector! NSTimeZone::isDaylightSavingTime not bound
!missing-selector! NSTimeZone::isEqualToTimeZone: not bound
!missing-selector! NSTimeZone::nextDaylightSavingTimeTransition not bound
!missing-selector! NSURL::checkPromisedItemIsReachableAndReturnError: not bound
!missing-selector! NSURL::checkResourceIsReachableAndReturnError: not bound
!missing-selector! NSURL::getPromisedItemResourceValue:forKey:error: not bound
!missing-selector! NSURL::initAbsoluteURLWithDataRepresentation:relativeToURL: not bound
!missing-selector! NSURL::initFileURLWithPath: not bound
!missing-selector! NSURL::initFileURLWithPath:relativeToURL: not bound
!missing-selector! NSURL::initWithDataRepresentation:relativeToURL: not bound
!missing-selector! NSURL::promisedItemResourceValuesForKeys:error: not bound
!missing-selector! NSURL::setResourceValues:error: not bound
!missing-selector! NSURL::URLByAppendingPathComponent: not bound
!missing-selector! NSURL::URLByResolvingSymlinksInPath not bound

Просмотреть файл

@ -1,6 +1,3 @@
## bound as a category - needs debugging (URL capitalizarion?)
!missing-selector! NSMutableURLRequest::bindToHotspotHelperCommand: not bound
## Native code has NWPathStatus in NetworkExtension and nw_path_status_t in Network (with the same elements).
## NetworkExtension.NWPathStatus is the oldest, but NetworkExtension isn't present on all the platforms Network
## is, which means we can't use the same managed enum for both cases (the native enums aren't entirely identical