You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While debugging 'System.NullReferenceException: Object reference not set to an instance of an object.' at XmlDoc2CmdletDoc.Core.Domain.Command.<>c.<get_OutputTypes> I eventually found the culprit to be the OutputType attribute on my cmdlet [OutputType(nameof(SomeObject))].
Removing it resolved it for now. It would be nice to know on which cmdlet, property or attribute it fails to easily correct the situation. At least the above will give guidance to others.
The text was updated successfully, but these errors were encountered:
Could you please provide a stack trace, or more specific steps on how to repeat this bug? There's a non-trivial amount of code in the Command class, and whilst I have some idea what might be causing this problem, it's not entirely clear. Also, you could try using [OutputType(typeof(SomeObject))] rather than [OutputType(nameof(SomeObject))]. nameof won't give you the fully-qualified name of SomeObject, which might be causing problems either instantiating the OutputTypeAttribute or resolving its Type property.
Thanks Chris... doing some late night OSS coding often means eyes are half-closed to spot a thing like this. Switched [OutputType(nameof(SomeObject))] to [OutputType(typeof(SomeObject))] on top of my public sealed cmdlet class with success.
For the record, the 'nameof' stacktrace is 1> System.NullReferenceException: Object reference not set to an instance of an object. 1> at XmlDoc2CmdletDoc.Core.Domain.Command.<>c.<get_OutputTypes>b__10_2(Type type) 1> at System.Linq.EnumerableSorter2.ComputeKeys(TElement[] elements, Int32 count)
1> at System.Linq.EnumerableSorter1.Sort(TElement[] elements, Int32 count) 1> at System.Linq.OrderedEnumerable1.d__1.MoveNext()
1> at XmlDoc2CmdletDoc.Core.Engine.GenerateReturnValuesElement(ICommentReader commentReader, Command command, ReportWarning reportWarning)
1> at XmlDoc2CmdletDoc.Core.Engine.GenerateCommandElement(ICommentReader commentReader, Command command, ReportWarning reportWarning)
1> at XmlDoc2CmdletDoc.Core.Engine.GenerateHelpItemsElement(ICommentReader commentReader, IEnumerable1 commands, ReportWarning reportWarning) 1> at XmlDoc2CmdletDoc.Core.Engine.GenerateHelp(Options options) 1> GenerateHelp completed with exit code 'UnhandledException'
While debugging 'System.NullReferenceException: Object reference not set to an instance of an object.' at XmlDoc2CmdletDoc.Core.Domain.Command.<>c.<get_OutputTypes> I eventually found the culprit to be the OutputType attribute on my cmdlet [OutputType(nameof(SomeObject))].
Removing it resolved it for now. It would be nice to know on which cmdlet, property or attribute it fails to easily correct the situation. At least the above will give guidance to others.
The text was updated successfully, but these errors were encountered: