コード例 #1
0
ファイル: EventSource.cs プロジェクト: wenzai007/dotnet462
        public EventSource(string namespaceName, string appName, InstrumentedAssembly instrumentedAssembly)
        {
            lock (eventSources)
            {
                // This is a pathalogical case where the process is shutting down, but
                // someone wants us to register us as a provider.  In this case, we ignore
                // the request.  This would be problematic if the eventSources list has already
                // been enumerated and all other eventSources unregistered.  If we were allowed
                // to register a new event source, it would never be unregistered
                if (shutdownInProgress != 0)
                {
                    return;
                }

                this.instrumentedAssembly = instrumentedAssembly;
                int hr = registrar.Register_(0, null, null, null, namespaceName, appName, this);

                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                // If we've gotten here, we were successful with the Register call
                eventSources.Add(this);
            }
        }
コード例 #2
0
 public EventSource(string namespaceName, string appName)
 {
     registrar.Register_(0, null, null, null, namespaceName, appName, this);
 }