commandlineparser / commandlineparser/commandline

Version 2.9.1 is generating the exception: System.MissingMethodException

Abierto
#819 4 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
C#
Estrellas
4.8k
Forks
478
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I was using version 2.7.82 and wanted to update it to 2.9.1 and started to see the following stack:
```
Unhandled exception. System.MissingMethodException: Method not found: 'Void CommandLine.VerbAttribute..ctor(System.String)'.
at System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount)
at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at CommandLine.Core.Verb.<>c.b__22_0(Type type)
at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.GetCount(Boolean onlyIfCheap)
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at CommandLine.Core.InstanceChooser.Choose(Func`3 tokenizer, IEnumerable`1 types, IEnumerable`1 arguments, StringComparer nameComparer, Boolean ignoreValueCase, CultureInfo parsingCulture, Boolean autoHelp, Boolean autoVersion, Boolean allowMultiInstance, IEnumerable`1 nonFatalErrors)
at CommandLine.Parser.ParseArguments(IEnumerable`1 args, Type[] types)
at CommandLine.ParserExtensions.ParseArguments[T1,T2,T3,T4](Parser parser, IEnumerable`1 args)
```

All my options have verbs like this:
```
[Verb("analyze", HelpText = "Analyze one or more binary files for security and correctness issues.")]
public class AnalyzeOptions : AnalyzeOptionsBase
```

And I invoke my options like this:
```
return Parser.Default.ParseArguments<
AnalyzeOptions,
TestOptions>(args)
.MapResult(
(AnalyzeOptions analyzeOptions) => new AnalyzeCommand().Run(analyzeOptions),
(TestOptions testOptions) => new TestCommand().Run(testOptions),
_ => HandleParseError(args, richResultCode));
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con el stack trace de MissingMethodException reportado y compara las versiones 2.7.82 y 2.9.1 de CommandLine utilizadas con las declaraciones de VerbAttribute y la llamada a ParseArguments mostradas. Reproduce el fallo con los tipos de opciones proporcionados; se considera terminado cuando la misma invocación se analiza correctamente en 2.9.1 sin la excepción MissingMethodException.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
cli
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.