Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit f03b1ec

Browse files
committed
Remove Serilog and GitHub.Extensions dependencies
Make it so that the *DictionaryManager code doesn't depend on Serilog, GitHub.Logging and GitHub.Extensions. This fixes tests executed using NCrunch in a new app domain (where the NCrunch assembly resolved isn't installed). LoadingResourceDictionary now uses Trace.WriteLine for logging, which should also work when executing in design mode.
1 parent afb8d2d commit f03b1ec

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

src/GitHub.UI/Helpers/LoadingResourceDictionary.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
using System.Windows;
44
using System.Reflection;
55
using System.Collections.Generic;
6-
using GitHub.Logging;
7-
using Serilog;
6+
using System.Diagnostics;
87

98
namespace GitHub
109
{
1110
public class LoadingResourceDictionary : ResourceDictionary
1211
{
13-
static readonly ILogger log = LogManager.ForContext<LoadingResourceDictionary>();
1412
static Dictionary<string, Assembly> assemblyDicts = new Dictionary<string, Assembly>();
1513

1614
public new Uri Source
@@ -31,7 +29,7 @@ void EnsureAssemblyLoaded(Uri value)
3129
var assemblyName = FindAssemblyNameFromPackUri(value);
3230
if (assemblyName == null)
3331
{
34-
log.Error("Couldn't find assembly name in '{Uri}'", value);
32+
Trace.WriteLine($"Couldn't find assembly name in '{value}'");
3533
return;
3634
}
3735

@@ -44,16 +42,16 @@ void EnsureAssemblyLoaded(Uri value)
4442

4543
if (!File.Exists(assemblyFile))
4644
{
47-
log.Error("Couldn't find assembly at '{AssemblyFile}'", assemblyFile);
45+
Trace.WriteLine($"Couldn't find assembly at '{assemblyFile}'");
4846
return;
4947
}
5048

5149
var assembly = Assembly.LoadFrom(assemblyFile);
5250
assemblyDicts.Add(assemblyFile, assembly);
5351
}
54-
catch(Exception e)
52+
catch (Exception)
5553
{
56-
log.Error(e, "Error loading assembly for '{Uri}'", value);
54+
Trace.WriteLine($"Error loading assembly for '{value}");
5755
}
5856
}
5957

src/GitHub.UI/Helpers/SharedDictionaryManager.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Windows;
33
using System.Collections.Generic;
4-
using GitHub.Extensions;
54
using System.Globalization;
65

76
namespace GitHub.UI.Helpers
@@ -17,8 +16,6 @@ public SharedDictionaryManager() : this(CachingFactory.GetInstanceForDomain())
1716

1817
public SharedDictionaryManager(CachingFactory factory)
1918
{
20-
Guard.ArgumentNotNull(factory, nameof(factory));
21-
2219
this.factory = factory;
2320
}
2421

@@ -77,9 +74,6 @@ public static CachingFactory GetInstanceForDomain()
7774

7875
public ResourceDictionary GetOrCreateResourceDictionary(ResourceDictionary owner, Uri uri)
7976
{
80-
Guard.ArgumentNotNull(owner, nameof(owner));
81-
Guard.ArgumentNotNull(uri, nameof(uri));
82-
8377
TryAddDisposable(owner);
8478

8579
ResourceDictionary rd;
@@ -95,8 +89,6 @@ public ResourceDictionary GetOrCreateResourceDictionary(ResourceDictionary owner
9589
// Remember subtypes that need disposing of.
9690
public void TryAddDisposable(object owner)
9791
{
98-
Guard.ArgumentNotNull(owner, nameof(owner));
99-
10092
var disposable = owner as IDisposable;
10193
if (disposable != null)
10294
{
@@ -132,8 +124,6 @@ public void Dispose()
132124

133125
public static Uri FixDesignTimeUri(Uri inUri)
134126
{
135-
Guard.ArgumentNotNull(inUri, nameof(inUri));
136-
137127
if (inUri.Scheme != "file")
138128
{
139129
return inUri;

0 commit comments

Comments
 (0)