ReflectionHelper.GetExecutingOrEntryAssembly is implemented like this:
|
return Assembly.GetEntryAssembly(); |
However, going by its name it should actually be implemented like this:
private static Assembly GetExecutingOrEntryAssembly()
{
return Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
}
Specifically, it would solve the failure of the current implementation when called from MSTest (for background see here):
Assert.Fail failed. Exception of type System.ArgumentException thrown as expected, but the provided predicate rejected it: System.ArgumentNullException: Value cannot be null.
Parameter name: element
at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T](Assembly element)
at CommandLine.Infrastructure.ReflectionHelper.GetAttribute[TAttribute]()
at CommandLine.Text.HelpText.AutoBuild[T](ParserResult`1 parserResult, Func`2 onError, Func`2 onExample, Boolean verbsIndex, Int32 maxDisplayWidth)
at CommandLine.Text.HelpText.AutoBuild[T](ParserResult`1 parserResult, Int32 maxDisplayWidth)
ReflectionHelper.GetExecutingOrEntryAssemblyis implemented like this:commandline/src/CommandLine/Infrastructure/ReflectionHelper.cs
Line 96 in a9243e9
However, going by its name it should actually be implemented like this:
Specifically, it would solve the failure of the current implementation when called from MSTest (for background see here):