Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventLogTarget"/> class.
 /// </summary>
 public EventLogTarget(IAppDomain appDomain)
 {
     this.Source = appDomain.FriendlyName;
     this.Log = "Application";
     this.MachineName = ".";
     this.MaxMessageLength = 16384;
 }
Exemplo n.º 2
0
		public Eval(Debugger debugger, IAppDomain appDomain, DBG.DnEval eval) {
			if (appDomain == null)
				throw new InvalidOperationException("The thread has no owner AppDomain and can't be used to evaluate funcs");
			this.debugger = debugger;
			this.appDomain = appDomain;
			this.eval = eval;
			this.eval.SetNoTotalTimeout();
		}
		public TextTemplatingHostAppDomainAssemblyResolver(
			IAppDomain hostAppDomain,
			IAddInTree addInTree)
		{
			this.hostAppDomain = hostAppDomain;
			this.addInTree = addInTree;
			hostAppDomain.AssemblyResolve += ResolveAssembly;
		}
 public TextTemplatingHostAppDomainAssemblyResolver(
     IAppDomain hostAppDomain,
     IAddInTree addInTree)
 {
     this.hostAppDomain             = hostAppDomain;
     this.addInTree                 = addInTree;
     hostAppDomain.AssemblyResolve += ResolveAssembly;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventLogTarget"/> class.
 /// </summary>
 public EventLogTarget(IAppDomain appDomain)
 {
     Source              = appDomain.FriendlyName;
     Log                 = "Application";
     MachineName         = ".";
     MaxMessageLength    = 16384;
     OptimizeBufferReuse = GetType() == typeof(EventLogTarget);  // Class not sealed, reduce breaking changes
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseDirLayoutRenderer" /> class.
        /// </summary>
        public BaseDirLayoutRenderer(IAppDomain appDomain)
        {
#if !NET_CF
            this.baseDir = appDomain.BaseDirectory;
#else
            this.baseDir = NLog.Internal.CompactFrameworkHelper.GetExeBaseDir();
#endif
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventLogTarget"/> class.
 /// </summary>
 public EventLogTarget(IAppDomain appDomain)
 {
     Source              = appDomain.FriendlyName;
     Log                 = "Application";
     MachineName         = ".";
     MaxMessageLength    = 16384;
     OptimizeBufferReuse = GetType() == typeof(EventLogTarget);
 }
Exemplo n.º 8
0
 public CavemanHammerRuntimePluginLoader(IAppDomain appDomain,
                                         IPluginLoaderSettings settings,
                                         IPluginLoaderFactory <ICaveManTool <Hammer> > pluginLoaderFactory,
                                         IPluginObjectCreator <ICaveManTool <Hammer> > pluginObjectCreator,
                                         IPluginPaths pluginPaths   = null,
                                         IPluginLoaderLogger logger = null)
     : base(appDomain, settings, pluginLoaderFactory, pluginObjectCreator, pluginPaths, logger)
 {
 }
Exemplo n.º 9
0
 public AssemblyCache(IAppDomain appDomain,
                      IAssemblyNameReader assemblyNameReader,
                      IPluginLoaderLogger logger)
 {
     _AppDomain          = appDomain;
     _AssemblyNameReader = assemblyNameReader;
     Assemblies          = new ConcurrentDictionary <string, IAssembly>();
     _Logger             = logger;
 }
Exemplo n.º 10
0
 public TestRuntimePluginLoader(IAppDomain appDomain,
                                IPluginLoaderSettings settings,
                                IPluginLoaderFactory <IOrganization> pluginLoaderFactory,
                                IPluginObjectCreator <IOrganization> pluginObjectCreator,
                                IPluginPaths pluginPaths,
                                IPluginLoaderLogger logger)
     : base(appDomain, settings, pluginLoaderFactory, pluginObjectCreator, pluginPaths, logger)
 {
 }
Exemplo n.º 11
0
 public AppPluginPaths(string appName,
                       string pluginSubFolder,
                       IAppDomain appDomain,
                       IPluginLoaderLogger logger)
 {
     AppName          = !string.IsNullOrWhiteSpace(appName) ? appName : throw new ArgumentException("message", nameof(appName));
     _PluginSubFolder = pluginSubFolder; // Optional
     _AppDomain       = appDomain ?? throw new ArgumentNullException(nameof(appDomain));
     _Logger          = logger;          // Optional
 }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventLogTarget"/> class.
        /// </summary>
        internal EventLogTarget(IEventLogWrapper eventLogWrapper, IAppDomain appDomain)
        {
            _eventLogWrapper = eventLogWrapper ?? new EventLogWrapper();
            appDomain        = appDomain ?? LogFactory.CurrentAppDomain;

            Source           = appDomain.FriendlyName;
            Log              = "Application";
            MachineName      = ".";
            MaxMessageLength = EventLogMaxMessageLength;
        }
Exemplo n.º 13
0
        internal TestSourceHost(string sourceFileName, IRunSettings runSettings, IFrameworkHandle frameworkHandle, IAppDomain appDomain)
        {
            this.sourceFileName  = sourceFileName;
            this.runSettings     = runSettings;
            this.frameworkHandle = frameworkHandle;

            this.appDomain = appDomain;

            // Set the environment context.
            this.SetContext(sourceFileName);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventLogTarget"/> class.
        /// </summary>
        internal EventLogTarget(IEventLogWrapper eventLogWrapper, IAppDomain appDomain)
        {
            _eventLogWrapper = eventLogWrapper ?? new EventLogWrapper();
            appDomain        = appDomain ?? LogFactory.CurrentAppDomain;

            Source              = appDomain.FriendlyName;
            Log                 = "Application";
            MachineName         = ".";
            MaxMessageLength    = EventLogMaxMessageLength;
            OptimizeBufferReuse = GetType() == typeof(EventLogTarget);  // Class not sealed, reduce breaking changes
        }
Exemplo n.º 15
0
 public Eval(Debugger debugger, IAppDomain appDomain, DBG.DnEval eval)
 {
     if (appDomain == null)
     {
         throw new InvalidOperationException("The thread has no owner AppDomain and can't be used to evaluate funcs");
     }
     this.debugger  = debugger;
     this.appDomain = appDomain;
     this.eval      = eval;
     this.eval.SetNoTotalTimeout();
 }
Exemplo n.º 16
0
 public AssemblyLoader(IAppDomain appDomain,
                       IPluginLoaderSettings settings,
                       IAssemblyCache assemblyCache,
                       IAssemblyNameReader assemblyNameReader,
                       IPluginLoaderLogger logger)
 {
     _AppDomain          = appDomain ?? throw new ArgumentNullException(nameof(appDomain));
     _Settings           = settings ?? throw new ArgumentNullException(nameof(settings));
     _AssemblyCache      = assemblyCache ?? throw new ArgumentNullException(nameof(assemblyCache));
     _AssemblyNameReader = assemblyNameReader ?? throw new ArgumentNullException(nameof(assemblyNameReader));
     _Logger             = logger;
 }
Exemplo n.º 17
0
        internal TestSourceHost(string sourceFileName, IRunSettings runSettings, IFrameworkHandle frameworkHandle, IAppDomain appDomain)
        {
            this.sourceFileName  = sourceFileName;
            this.runSettings     = runSettings;
            this.frameworkHandle = frameworkHandle;
            this.appDomain       = appDomain;

            // Set the environment context.
            this.SetContext(sourceFileName);

            // Set isAppDomainCreationDisabled flag
            this.isAppDomainCreationDisabled = (this.runSettings != null) && MSTestAdapterSettings.IsAppDomainCreationDisabled(this.runSettings.SettingsXml);
        }
 public PluginDependencyResolverObjectCreator(IAppDomain appDomain,
                                              IPluginLoaderSettings settings,
                                              IAssemblyLoader assemblyLoader,
                                              IWaiter waiter,
                                              IAssemblyResolveCache assemblyResolveCache,
                                              IPluginLoaderLogger logger)
 {
     _AppDomain            = appDomain ?? throw new ArgumentNullException(nameof(appDomain));
     _Settings             = settings ?? throw new ArgumentNullException(nameof(settings));
     _AssemblyLoader       = assemblyLoader ?? throw new ArgumentNullException(nameof(assemblyLoader));
     _Waiter               = waiter;
     _AssemblyResolveCache = assemblyResolveCache;
     _Logger               = logger;
 }
Exemplo n.º 19
0
        object Create(XmlNode section, IAppDomain appDomain)
        {
            try
            {
                string configFileName = appDomain.ConfigurationFile;

                return(new XmlLoggingConfiguration(section.OuterXml, configFileName, LogManager.LogFactory));
            }
            catch (Exception exception)
            {
                InternalLogger.Error(exception, "ConfigSectionHandler error.");

                //TODO NLog 5, check MustBeRethrown()
                throw;
            }
        }
Exemplo n.º 20
0
        object Create(XmlNode section, IAppDomain appDomain)
        {
            try
            {
                string configFileName = appDomain.ConfigurationFile;

                return new XmlLoggingConfiguration((XmlElement)section, configFileName);
            }
            catch (Exception exception)
            {
                InternalLogger.Error(exception, "ConfigSectionHandler error.");
              
                //TODO NLog 5, check MustBeRethrown()
                throw;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Log4JXmlEventLayoutRenderer" /> class.
        /// </summary>
        public Log4JXmlEventLayoutRenderer(IAppDomain appDomain)
        {
            this.IncludeNLogData = true;
            this.NdcItemSeparator = " ";

#if SILVERLIGHT
            this.AppInfo = "Silverlight Application";
#else
            this.AppInfo = string.Format(
                CultureInfo.InvariantCulture,
                "{0}({1})", 
                appDomain.FriendlyName, 
                ThreadIDHelper.Instance.CurrentProcessID);
#endif

            this.Parameters = new List<NLogViewerParameterInfo>();
        }
Exemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Log4JXmlEventLayoutRenderer" /> class.
        /// </summary>
        public Log4JXmlEventLayoutRenderer(IAppDomain appDomain)
        {
            this.IncludeNLogData  = true;
            this.NdcItemSeparator = " ";

#if SILVERLIGHT
            this.AppInfo = "Silverlight Application";
#else
            this.AppInfo = string.Format(
                CultureInfo.InvariantCulture,
                "{0}({1})",
                appDomain.FriendlyName,
                ThreadIDHelper.Instance.CurrentProcessID);
#endif

            this.Parameters = new List <NLogViewerParameterInfo>();
        }
Exemplo n.º 23
0
        object Create(XmlNode section, IAppDomain appDomain)
        {
            try
            {
                string configFileName = appDomain.ConfigurationFile;

                return(new XmlLoggingConfiguration((XmlElement)section, configFileName));
            }
            catch (Exception exception)
            {
                if (exception.MustBeRethrown())
                {
                    throw;
                }

                InternalLogger.Error("ConfigSectionHandler error: {0}", exception);
                throw;
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Log4JXmlEventLayoutRenderer" /> class.
        /// </summary>
        public Log4JXmlEventLayoutRenderer(IAppDomain appDomain)
        {
            IncludeNLogData  = true; // TODO NLog ver. 5 - Disable this by default, as mostly duplicate data is added
            NdcItemSeparator = " ";
#if !SILVERLIGHT
            NdlcItemSeparator = " ";
#endif

#if SILVERLIGHT
            AppInfo = "Silverlight Application";
#elif NETSTANDARD1_3
            AppInfo = "NetCore Application";
#elif __IOS__
            AppInfo = "MonoTouch Application";
#else
            AppInfo = string.Format(
                CultureInfo.InvariantCulture,
                "{0}({1})",
                appDomain.FriendlyName,
                ProcessIDHelper.Instance.CurrentProcessID);
#endif

            Parameters = new List <NLogViewerParameterInfo>();

            try
            {
                _machineName = EnvironmentHelper.GetMachineName();
                if (string.IsNullOrEmpty(_machineName))
                {
                    InternalLogger.Info("MachineName is not available.");
                }
            }
            catch (Exception exception)
            {
                InternalLogger.Error(exception, "Error getting machine name.");
                if (exception.MustBeRethrown())
                {
                    throw;
                }

                _machineName = string.Empty;
            }
        }
Exemplo n.º 25
0
        object Create(XmlNode section, IAppDomain appDomain)
        {
            try
            {
                string configFileName = appDomain.ConfigurationFile;

                return new XmlLoggingConfiguration((XmlElement)section, configFileName);
            }
            catch (Exception exception)
            {
                if (exception.MustBeRethrown())
                {
                    throw;
                }

                InternalLogger.Error("ConfigSectionHandler error: {0}", exception);
                throw;
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Log4JXmlEventLayoutRenderer" /> class.
        /// </summary>
        public Log4JXmlEventLayoutRenderer(IAppDomain appDomain)
        {
            this.IncludeNLogData  = true;
            this.NdcItemSeparator = " ";
#if NET4_0 || NET4_5
            this.NdlcItemSeparator = " ";
#endif

#if SILVERLIGHT
            this.AppInfo = "Silverlight Application";
#elif __IOS__
            this.AppInfo = "MonoTouch Application";
#else
            this.AppInfo = string.Format(
                CultureInfo.InvariantCulture,
                "{0}({1})",
                appDomain.FriendlyName,
                ThreadIDHelper.Instance.CurrentProcessID);
#endif

            this.Parameters = new List <NLogViewerParameterInfo>();

            try
            {
#if SILVERLIGHT
                this._machineName = "silverlight";
#else
                this._machineName = Environment.MachineName;
#endif
            }
            catch (System.Security.SecurityException)
            {
                this._machineName = string.Empty;
            }

            this._xmlWriterSettings = new XmlWriterSettings
            {
                Indent           = this.IndentXml,
                ConformanceLevel = ConformanceLevel.Fragment,
                IndentChars      = "  ",
            };
        }
Exemplo n.º 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Log4JXmlEventLayoutRenderer" /> class.
        /// </summary>
        public Log4JXmlEventLayoutRenderer(IAppDomain appDomain)
        {
            this.IncludeNLogData = true;
            this.NdcItemSeparator = " ";

#if SILVERLIGHT
            this.AppInfo = "Silverlight Application";
#elif __IOS__
			this.AppInfo = "MonoTouch Application";
#else
            this.AppInfo = string.Format(
                CultureInfo.InvariantCulture,
                "{0}({1})", 
                appDomain.FriendlyName, 
                ThreadIDHelper.Instance.CurrentProcessID);
#endif

            this.Parameters = new List<NLogViewerParameterInfo>();

            try
            {
#if SILVERLIGHT
                this.machineName = "silverlight";
#else
                this.machineName = Environment.MachineName;
#endif
            }
            catch (System.Security.SecurityException)
            {
                this.machineName = string.Empty;
            }

            this.xmlWriterSettings = new XmlWriterSettings
            {
                Indent = this.IndentXml,
                ConformanceLevel = ConformanceLevel.Fragment,
                IndentChars = "  ",
            };
        }
Exemplo n.º 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Log4JXmlEventLayoutRenderer" /> class.
        /// </summary>
        public Log4JXmlEventLayoutRenderer(IAppDomain appDomain)
        {
            IncludeNLogData  = true; // TODO NLog ver. 5 - Disable this by default, as mostly duplicate data is added
            NdcItemSeparator = " ";
#if !SILVERLIGHT
            NdlcItemSeparator = " ";
#endif

#if SILVERLIGHT
            AppInfo = "Silverlight Application";
#elif WINDOWS_UWP
            AppInfo = "UWP Application";
#elif __IOS__
            AppInfo = "MonoTouch Application";
#else
            AppInfo = string.Format(
                CultureInfo.InvariantCulture,
                "{0}({1})",
                appDomain.FriendlyName,
                ThreadIDHelper.Instance.CurrentProcessID);
#endif

            Parameters = new List <NLogViewerParameterInfo>();

            try
            {
#if SILVERLIGHT
                _machineName = "silverlight";
#elif WINDOWS_UWP
                _machineName = "uwp";
#else
                _machineName = Environment.MachineName;
#endif
            }
            catch (System.Security.SecurityException)
            {
                _machineName = string.Empty;
            }
        }
 public RuntimePluginLoaderBase(IAppDomain appDomain,
                                IPluginLoaderSettings settings,
                                IPluginLoaderFactory <T> pluginLoaderFactory,
                                IPluginObjectCreator <T> pluginObjectCreator,
                                IPluginPaths pluginPaths                = null,
                                IPluginLoaderLogger logger              = null,
                                bool disconnectResolverOnPluginLoad     = false,
                                bool disconnectResolverOnPluginTypeLoad = false)
 {
     _AppDomain           = appDomain ?? throw new ArgumentNullException(nameof(appDomain));
     _Settings            = settings ?? throw new ArgumentNullException(nameof(settings));
     _PluginLoaderFactory = pluginLoaderFactory ?? throw new ArgumentNullException(nameof(pluginLoaderFactory));
     _PluginObjectCreator = pluginObjectCreator ?? throw new ArgumentNullException(nameof(pluginObjectCreator));
     pluginPaths          = pluginPaths ?? new AppPluginPaths(_Settings.AppName, GetDefaultPluginDirectory(), _AppDomain, _Logger);
     _PluginPaths         = string.IsNullOrWhiteSpace(PluginSubFolder)
                  ? pluginPaths
                  : new PluginPaths {
         Paths = pluginPaths.Paths.Select(p => Path.Combine(p, PluginSubFolder))
     };
     _Logger = logger;
     _DisconnectResolverOnPluginLoad     = disconnectResolverOnPluginLoad;
     _DisconnectResolverOnPluginTypeLoad = disconnectResolverOnPluginTypeLoad;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseDirLayoutRenderer" /> class.
 /// </summary>
 public BaseDirLayoutRenderer(IAppDomain appDomain)
 {
     this.baseDir = appDomain.BaseDirectory;
 }
Exemplo n.º 31
0
 public AppDomainProcessExitIntegration(IAppDomain?appDomain = null)
 {
     _appDomain = appDomain ?? AppDomainAdapter.Instance;
 }
Exemplo n.º 32
0
 /// <summary>
 /// Create a new renderer
 /// </summary>
 public AppDomainLayoutRenderer(IAppDomain currentDomain)
 {
     _currentDomain = currentDomain;
     Format         = LongFormatCode;
 }
 internal AppDomainUnhandledExceptionIntegration(IAppDomain appDomain = null)
 => _appDomain = appDomain ?? AppDomainAdapter.Instance;
Exemplo n.º 34
0
 public AppEnvironmentWrapper(IAppDomain appDomain)
 {
     AppDomain = appDomain;
 }
Exemplo n.º 35
0
 /// <inheritdoc />
 public void Unload(IAppDomain domain)
 {
     AppDomain.Unload(domain.AppDomainInstance);
 }
Exemplo n.º 36
0
 private void TestTest(IAppDomain wrap)
 {
     Assert.NotNull(wrap);
 }
Exemplo n.º 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseDirLayoutRenderer" /> class.
 /// </summary>
 public BaseDirLayoutRenderer(IAppDomain appDomain)
 {
     _baseDir = appDomain.BaseDirectory;
 }
Exemplo n.º 38
0
 /// <inheritdoc />
 public void Unload(IAppDomain domain)
 {
     AppDomain.Unload(domain.AppDomainInstance);
 }
Exemplo n.º 39
0
 public EventLogTarget(IAppDomain appDomain)
     : this(null, appDomain)
 {
 }
Exemplo n.º 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventLogTarget"/> class.
 /// </summary>
 public EventLogTarget(IAppDomain appDomain)
 {
     this.Source      = appDomain.FriendlyName;
     this.Log         = "Application";
     this.MachineName = ".";
 }
Exemplo n.º 41
0
 /// <inheritdoc />
 public void Unload(IAppDomain domain)
 {
     AppDomain.Unload(((IWrap<AppDomain>)domain).UnderlyingObject);
 }
Exemplo n.º 42
0
 /// <summary>
 /// Create a new renderer
 /// </summary>
 public AppDomainLayoutRenderer(IAppDomain currentDomain)
 {
     _currentDomain = currentDomain;
     Format = LongFormatCode;
 }
Exemplo n.º 43
0
 /// <inheritdoc />
 public void Unload(IAppDomain domain)
 {
     AppDomain.Unload(((IWrap <AppDomain>)domain).UnderlyingObject);
 }