Skip to content

Commit 1b7a9a5

Browse files
author
Stewart Miles
committed
Handle NotSupportedException when accessing Assembly.Location
This is an improvement on I546aedbacb02b2a07352781865c5263304664909 which handles null Assembly locations but didn't handle the Location property raising a NotSupportedException. Fixes #362 Change-Id: I5c6aa3b48dd3af5d26b2187668bab114df5c8a1c
1 parent b3c7743 commit 1b7a9a5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

source/VersionHandlerImpl/src/VersionHandlerImpl.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,14 +2349,17 @@ private static bool EnabledEditorDllsLoaded {
23492349
get {
23502350
var loadedAssemblyPaths = new HashSet<string>();
23512351
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
2352-
if (String.IsNullOrEmpty(assembly.Location)) continue;
2352+
string location;
23532353
try {
2354-
var path = Path.GetFullPath(assembly.Location);
2355-
if (enabledEditorDlls.Contains(path)) {
2356-
loadedAssemblyPaths.Add(path);
2357-
}
2354+
location = assembly.Location;
23582355
} catch (NotSupportedException) {
23592356
// Dynamic assemblies do not have a file location so ignore.
2357+
continue;
2358+
}
2359+
if (String.IsNullOrEmpty(location)) continue;
2360+
var path = Path.GetFullPath(location);
2361+
if (enabledEditorDlls.Contains(path)) {
2362+
loadedAssemblyPaths.Add(path);
23602363
}
23612364
}
23622365
return loadedAssemblyPaths.IsSupersetOf(enabledEditorDlls);

0 commit comments

Comments
 (0)