Example #1
0
        private static string GetProcessFromRunningProcess()
        {
#if RUNTIME_TYPE_NETCORE
            return(AssemblyUtilities.GetAssemblyLocation(AssemblyUtilities.EntryAssembly));
#else
            return(Process.GetCurrentProcess().MainModule.FileName);
#endif
        }
Example #2
0
        private static string GetProcessFromRunningProcess()
        {
#if RUNTIME_TYPE_NETCORE
            // The EntryAssembly property can return null when a managed assembly has been loaded from
            // an unmanaged application (for example, using custom CLR hosting).
            if (AssemblyUtilities.EntryAssembly == null)
            {
                return(Process.GetCurrentProcess().MainModule.FileName);
            }

            return(AssemblyUtilities.GetAssemblyLocation(AssemblyUtilities.EntryAssembly));
#else
            return(Process.GetCurrentProcess().MainModule.FileName);
#endif
        }