Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/ReactiveUI/Mixins/DependencyResolverMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -44,7 +45,9 @@ public static void InitializeReactiveUI(this IMutableDependencyResolver resolver

var assemblyName = new AssemblyName(fdr.AssemblyQualifiedName.Replace(fdr.FullName + ", ", string.Empty));

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

/// <summary>
Expand Down Expand Up @@ -118,5 +121,12 @@ 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);
}
}
}