Runtime: EventPipeController ctor potentially throws ArgumentNullException?

Created on 17 Apr 2019  ·  1Comment  ·  Source: dotnet/runtime

EventPipeController's ctor accesses AppContext.BaseDirectory and passes the result to Path.Combine, which will throw an ArgumentNullException if BaseDirectory returns null. BaseDirectory returns the result of GetBaseDirectoryCore, which calls Assembly.GetEntryAssembly()?.Location. GetEntryAssembly may return null, in which case GetBaseDirectoryCore will return null, in which case Path.Combine will throw and the EventPipeController ctor will throw. This will be eaten in the Initialize method by a catch-all block, but it seems like it'd be better not to throw in the first place.

EventPipe area-Tracing-coreclr bug

Most helpful comment

The file-based configuration invocation of EventPipe is meant to silently fail if something goes wrong--as you mentioned, this logic is wrapped in a try/catch/finally block. Since the file-based configuration invocation of Eventpipe is going to be removed entirely in an upcoming change, I'm going to leave this as-is for now.

>All comments

The file-based configuration invocation of EventPipe is meant to silently fail if something goes wrong--as you mentioned, this logic is wrapped in a try/catch/finally block. Since the file-based configuration invocation of Eventpipe is going to be removed entirely in an upcoming change, I'm going to leave this as-is for now.

Was this page helpful?
0 / 5 - 0 ratings