Permalink
Browse files

Fix early load of DLLs on .NET 4.5 and literally anywhere other than …

….NET 4.0

I break this block of code literally every release.
  • Loading branch information...
paulcbetts committed Dec 15, 2012
1 parent ef24939 commit 5d40c60322a932bd9ccf11877e3da9b09a6fcf5e
Showing with 11 additions and 2 deletions.
  1. +11 −2 ReactiveUI/RxApp.cs
View
@@ -9,6 +9,7 @@
using System.Linq.Expressions;
using System.Reactive.Subjects;
using System.Reflection;
+using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@@ -421,15 +422,16 @@ static IEnumerable<string> attemptToEarlyLoadReactiveUIDLLs()
return new[] {"ReactiveUI.Xaml"};
#else
var name = Assembly.GetExecutingAssembly().GetName();
+ var suffix = getArchSuffixForPath(Assembly.GetExecutingAssembly().Location);
return guiLibs.SelectMany(x => {
- var fullName = String.Format("{0}, Version={1}, Culture=neutral, PublicKeyToken=null", x, name.Version.ToString());
+ var fullName = String.Format("{0}{1}, Version={2}, Culture=neutral, PublicKeyToken=null", x, suffix, name.Version.ToString());
var assemblyLocation = Assembly.GetExecutingAssembly().Location;
if (String.IsNullOrEmpty(assemblyLocation))
return Enumerable.Empty<string>();
- var path = Path.Combine(Path.GetDirectoryName(assemblyLocation), x + ".dll");
+ var path = Path.Combine(Path.GetDirectoryName(assemblyLocation), x + suffix + ".dll");
if (!File.Exists(path) && !RxApp.InUnitTestRunner()) {
LogHost.Default.Debug("Couldn't find {0}", path);
return Enumerable.Empty<string>();
@@ -445,6 +447,13 @@ static IEnumerable<string> attemptToEarlyLoadReactiveUIDLLs()
});
#endif
}
+
+ static string getArchSuffixForPath(string path)
+ {
+ var re = new Regex(@"(_[A-Za-z0-9]+)\.");
+ var m = re.Match(Path.GetFileName(path));
+ return m.Success ? m.Groups[1].Value : "";
+ }
}
public class NullDefaultPropertyBindingProvider : IDefaultPropertyBindingProvider

0 comments on commit 5d40c60

Please sign in to comment.