diff --git a/2017.Standard/FodyWeavers.xml b/2017.Standard/FodyWeavers.xml
index a5dcf04..6ef9a82 100644
--- a/2017.Standard/FodyWeavers.xml
+++ b/2017.Standard/FodyWeavers.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/2017/FodyWeavers.xml b/2017/FodyWeavers.xml
index a5dcf04..6ef9a82 100644
--- a/2017/FodyWeavers.xml
+++ b/2017/FodyWeavers.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/2019.Standard/FodyWeavers.xml b/2019.Standard/FodyWeavers.xml
index a5dcf04..6ef9a82 100644
--- a/2019.Standard/FodyWeavers.xml
+++ b/2019.Standard/FodyWeavers.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/2019/FodyWeavers.xml b/2019/FodyWeavers.xml
index a5dcf04..6ef9a82 100644
--- a/2019/FodyWeavers.xml
+++ b/2019/FodyWeavers.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/Shared/Models/VisualizerData.cs b/Shared/Models/VisualizerData.cs
index 7e69742..2f31051 100644
--- a/Shared/Models/VisualizerData.cs
+++ b/Shared/Models/VisualizerData.cs
@@ -22,6 +22,10 @@ public class VisualizerData {
public bool CanSelectLexer { get; }
public bool CanSelectParser { get; }
+ private static readonly string[] loadErrorExceptions = new[] {
+ "Microsoft.Xaml.Behaviors.Wpf"
+ };
+
public VisualizerData(object o, Config config) {
if (config is null) { throw new ArgumentNullException(nameof(config)); }
@@ -36,14 +40,17 @@ T createInstance(string typename, object[] args = null) =>
types = AppDomain.CurrentDomain.GetAssemblies()
.Where(x => x != GetType().Assembly)
.SelectMany(x => {
- try {
- return x.GetTypes();
+ var ret = Empty();
+ if (!x.FullName.StartsWithAny(loadErrorExceptions)) {
+ try {
+ ret = x.GetTypes();
#pragma warning disable CA1031 // Do not catch general exception types
- } catch {
+ } catch {
#pragma warning restore CA1031 // Do not catch general exception types
- AssemblyLoadErrors.Add(x.FullName);
- return Empty();
+ AssemblyLoadErrors.Add(x.FullName);
+ }
}
+ return ret;
})
.Where(x => !x.IsAbstract)
.ToArray();
diff --git a/Shared/Util/Extensions/String.cs b/Shared/Util/Extensions/String.cs
index 96afa8c..41c5ff2 100644
--- a/Shared/Util/Extensions/String.cs
+++ b/Shared/Util/Extensions/String.cs
@@ -42,5 +42,6 @@ public static string ToCSharpLiteral(this string input, bool withQuotationMarks
}
public static bool ContainsAny(this string s, params string[] testStrings) => testStrings.Any(x => s.Contains(x));
+ public static bool StartsWithAny(this string s, params string[] testStrings) => testStrings.Any(x => s.StartsWith(x, StringComparison.InvariantCulture));
}
}
diff --git a/Shared/ViewModels/VisualizerDataViewModel.cs b/Shared/ViewModels/VisualizerDataViewModel.cs
index c041b0e..0ca3beb 100644
--- a/Shared/ViewModels/VisualizerDataViewModel.cs
+++ b/Shared/ViewModels/VisualizerDataViewModel.cs
@@ -118,7 +118,7 @@ public RelayCommand ChangeSelection {
if (changeSelection == null) {
changeSelection = new RelayCommand(sender => {
updateSelection(sender);
- var firstSelected = Tokens.FirstOrDefault(x => x.IsSelected);
+ var firstSelected = Tokens?.FirstOrDefault(x => x.IsSelected);
if (TokensGrid is null || firstSelected is null) { return; }
TokensGrid.ScrollIntoView(firstSelected);
});