| Severity | Error |
| Reported by | PostSharp |
| Message | Invalid metadata in module "<Module>": the signature of the method <Method> declares <ParameterCount> parameter(s), but the Param table gives the sequence <Sequence> to one of its parameters. |
Cause
In the metadata of a .NET assembly, the signature of a method gives the types of its parameters, and the rows of the Param table give their names and attributes. Each row has a sequence number: 0 for the return value, then 1 to the number of parameters of the signature. The ECMA-335 standard does not allow a larger sequence number.
PostSharp reports PS0282 when it reads a module, either the assembly that it transforms or a referenced assembly, in which a Param row of the method <Method> has the sequence number <Sequence>, larger than the <ParameterCount> parameters of its signature. PostSharp leaves this row out of the parameters of the method and continues, but the result of the build cannot be trusted.
A compiler does not produce such metadata. The module was usually damaged, or produced or rewritten by a tool with a bug: an obfuscator, an IL rewriter or another post-compiler.
This message requires an assembly with invalid metadata, so no example can show it.
Resolution
- Identify the module from
<Module>. When it is a referenced assembly, check that it is the file that its package or its project produces: delete thebinandobjdirectories and the package from the NuGet cache, then restore and rebuild. - When a tool rewrites the module before PostSharp reads it, such as an obfuscator or another IL rewriter, build without this tool to confirm that it causes the problem, then report the problem to its vendor, or run it after PostSharp.
- When the module is produced by the C# or Visual Basic compiler alone, report the problem to PostSharp support with the module.
See Also
Other Resources