commandlineparser / commandlineparser/commandline
TypeLoadException on generating help text
- Ngôn ngữ chính
- C#
- Star
- 4.8k
- Fork
- 478
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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[])```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu tại CommandLine.Infrastructure.ReflectionHelper.GetAttribute và lần theo đường đi của các lời gọi qua CommandLine.Text.HelpText.AutoBuild và Parser.DisplayHelp, sử dụng stack trace làm điểm vào. Nếu có thể, hãy tái hiện lỗi khi khởi động và xác định thuộc tính kiểu hoặc assembly nào không thể được tải và lý do; một kết quả hữu ích sẽ là nguyên nhân đã được xác nhận cùng với một bản sửa lỗi hoặc cải thiện chẩn đoán được xác định trong phạm vi hẹp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100