Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: issues with binding to library (#2272)
  • Loading branch information
glennawatson authored and RLittlesII committed Dec 5, 2019
1 parent 25522a7 commit f79c82b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/ReactiveUI/Mixins/DependencyResolverMixins.cs
Expand Up @@ -46,7 +46,6 @@ public static void InitializeReactiveUI(this IMutableDependencyResolver resolver
var assemblyName = new AssemblyName(fdr.AssemblyQualifiedName.Replace(fdr.FullName + ", ", string.Empty));

extraNs
.Where(GetNamespaceExists)
.ForEach(ns => ProcessRegistrationForNamespace(ns, assemblyName, resolver));
}

Expand Down Expand Up @@ -109,10 +108,10 @@ private static Func<object> TypeFactory(TypeInfo typeInfo)
}

[SuppressMessage("Globalization", "CA1307: operator could change based on locale settings", Justification = "Replace() does not have third parameter on all platforms")]
private static void ProcessRegistrationForNamespace(string ns, AssemblyName assemblyName, IMutableDependencyResolver resolver)
private static void ProcessRegistrationForNamespace(string namespaceName, AssemblyName assemblyName, IMutableDependencyResolver resolver)
{
var targetType = ns + ".Registrations";
var fullName = targetType + ", " + assemblyName.FullName.Replace(assemblyName.Name, ns);
var targetType = namespaceName + ".Registrations";
var fullName = targetType + ", " + assemblyName.FullName.Replace(assemblyName.Name, namespaceName);

var registerTypeClass = Reflection.ReallyFindType(fullName, false);
if (registerTypeClass != null)
Expand All @@ -121,12 +120,5 @@ private static void ProcessRegistrationForNamespace(string ns, AssemblyName asse
registerer.Register((f, t) => resolver.RegisterConstant(f(), t));
}
}

private static bool GetNamespaceExists(string namespaceName)
{
string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string assemblyPath = Path.Combine(folderPath, new AssemblyName(namespaceName).Name + ".dll");
return File.Exists(assemblyPath);
}
}
}

0 comments on commit f79c82b

Please sign in to comment.