Skip to content

Commit d1c4eba

Browse files
committed
Add ASSEMBLY_LOAD_STACKTRACE guard
Otherwise this is incredibly noisy with diagnostic logging.
1 parent 044c81e commit d1c4eba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using System.Management.Automation;
1313
using System.Management.Automation.Runspaces;
1414

15-
#if DEBUG
15+
#if ASSEMBLY_LOAD_STACKTRACE
1616
using System.Diagnostics;
1717
#endif
1818

@@ -98,7 +98,7 @@ public static EditorServicesLoader Create(
9898

9999
AssemblyLoadContext.Default.Resolving += (AssemblyLoadContext _, AssemblyName asmName) =>
100100
{
101-
#if DEBUG
101+
#if ASSEMBLY_LOAD_STACKTRACE
102102
logger.Log(PsesLogLevel.Diagnostic, $"Assembly resolve event fired for {asmName}. Stacktrace:\n{new StackTrace()}");
103103
#else
104104
logger.Log(PsesLogLevel.Diagnostic, $"Assembly resolve event fired for {asmName}");
@@ -138,7 +138,7 @@ public static EditorServicesLoader Create(
138138
// Unlike in .NET Core, we need to be look for all dependencies in .NET Framework, not just PSES.dll
139139
AppDomain.CurrentDomain.AssemblyResolve += (object sender, ResolveEventArgs args) =>
140140
{
141-
#if DEBUG
141+
#if ASSEMBLY_LOAD_STACKTRACE
142142
logger.Log(PsesLogLevel.Diagnostic, $"Assembly resolve event fired for {args.Name}. Stacktrace:\n{new StackTrace()}");
143143
#else
144144
logger.Log(PsesLogLevel.Diagnostic, $"Assembly resolve event fired for {args.Name}");

0 commit comments

Comments
 (0)