We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 19d4edd commit 057b068Copy full SHA for 057b068
1 file changed
src/FlowSynx.PluginCore/Helpers/ReflectionHelper.cs
@@ -0,0 +1,26 @@
1
+using System.Diagnostics;
2
+
3
+namespace FlowSynx.PluginCore.Helpers;
4
5
+public static class ReflectionHelper
6
+{
7
+ public static bool IsCalledViaReflection()
8
+ {
9
+ var stack = new StackTrace();
10
+ var frames = stack.GetFrames();
11
12
+ if (frames == null)
13
+ return false;
14
15
+ foreach (var frame in frames)
16
17
+ var callingMethod = frame.GetMethod();
18
+ if (callingMethod == null) continue;
19
20
+ if (callingMethod.DeclaringType?.Namespace?.StartsWith("System.Reflection") == true)
21
+ return true;
22
+ }
23
24
25
26
+}
0 commit comments