commandlineparser / commandlineparser/commandline

TypeLoadException on generating help text

未關閉
#779 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
4.8k
分支
478
PR 合併指標
30 天內沒有已合併 PR

描述

Hi there,

a customer of ours gets this stack trace when our application is starting, and we are not able to determine whats going on. I traced it back in the source code to the first reflection call to getting a license attribute out of the executing assembly, but since our application is crashing immediately with no output I have to rely on whats event viewer has. And event viewer unfortunately does not tell me which type could not be loaded and why. Any ideas might be helpful:
```Application: App.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeLoadException
at System.ModuleHandle.ResolveType(System.Reflection.RuntimeModule, Int32, IntPtr*, Int32, IntPtr*, Int32, System.Runtime.CompilerServices.ObjectHandleOnStack)
at System.ModuleHandle.ResolveTypeHandleInternal(System.Reflection.RuntimeModule, Int32, System.RuntimeTypeHandle[], System.RuntimeTypeHandle[])
at System.Reflection.RuntimeModule.ResolveType(Int32, System.Type[], System.Type[])
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(System.Reflection.CustomAttributeRecord, System.Reflection.MetadataImport, System.Reflection.Assembly ByRef, System.Reflection.RuntimeModule, System.Reflection.MetadataToken, System.RuntimeType, Boolean, System.Object[], System.Collections.IList, System.RuntimeType ByRef, System.IRuntimeMethodInfo ByRef, Boolean ByRef, Boolean ByRef)
at System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeModule, Int32, Int32, System.RuntimeType, Boolean, System.Collections.IList, Boolean)
at System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeAssembly, System.RuntimeType)
at System.Reflection.RuntimeAssembly.GetCustomAttributes(System.Type, Boolean)
at System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, Boolean)
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Reflection.Assembly)
at CommandLine.Infrastructure.ReflectionHelper.GetAttribute[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]()
at CommandLine.Text.HelpText.AutoBuild[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](CommandLine.ParserResult`1, System.Func`2, System.Func`2, Boolean, Int32)
at CommandLine.Text.HelpText.AutoBuild[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](CommandLine.ParserResult`1, Int32)
at CommandLine.Parser+<>c__DisplayClass17_0`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].b__1(System.Collections.Generic.IEnumerable`1, System.IO.TextWriter)
at CSharpx.MaybeExtensions.Do[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](CSharpx.Maybe`1>, System.Action`2)
at CommandLine.Parser+<>c__DisplayClass17_0`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].b__0(System.Collections.Generic.IEnumerable`1)
at CommandLine.ParserResultExtensions.WithNotParsed[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](CommandLine.ParserResult`1, System.Action`1>)
at CommandLine.Parser.DisplayHelp[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](CommandLine.ParserResult`1, System.IO.TextWriter, Int32)
at CommandLine.Parser.MakeParserResult[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](CommandLine.ParserResult`1, CommandLine.ParserSettings)
at CommandLine.Parser.ParseArguments[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1)
at App.Program.Main(System.String[])```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start at CommandLine.Infrastructure.ReflectionHelper.GetAttribute and follow the call path through CommandLine.Text.HelpText.AutoBuild and Parser.DisplayHelp, using the stack trace as the entry point. Reproduce the startup failure if possible and identify which type or assembly attribute cannot be loaded and why; a useful outcome would be a confirmed cause and a narrowly defined fix or diagnostic improvement.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。