{"record":{"id":"c0c9d76b1ca0091a","repo":"icsharpcode/ILSpy","slug":"error-c0c9d7","errorCode":null,"errorMessage":"error","messagePattern":"error","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs","lineNumber":327,"sourceCode":"\r\n\t\t/// <summary>\r\n\t\t/// The headline a front end puts above the list of failures it recovered from. Shared so the\r\n\t\t/// UI, the command line and any other consumer say the same thing and point at the same URL.\r\n\t\t/// </summary>\r\n\t\tpublic static IEnumerable<string> GetErrorSummaryLines(int errorCount)\r\n\t\t{\r\n\t\t\tyield return $\"{errorCount} error(s) occurred; the affected code was replaced by the error text in the output.\";\r\n\t\t\tyield return $\"Please report them at {DecompilationErrorReportUrl}:\";\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// The one-line description of a single failure, so the UI and the command line name it the\r\n\t\t/// same way.\r\n\t\t/// </summary>\r\n\t\tpublic static string GetErrorHeadline(DecompilerException error)\r\n\t\t{\r\n\t\t\tif (error == null)\r\n\t\t\t\tthrow new ArgumentNullException(nameof(error));\r\n\t\t\treturn error.InnerException == null ? error.Message : $\"{error.Message}: {error.InnerException.Message}\";\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// Renders <paramref name=\"error\"/> as the lines of a comment block: an explanation, the\r\n\t\t/// request to report it, and the full exception including its stack trace, which is what\r\n\t\t/// makes such a report actionable.\r\n\t\t/// </summary>\r\n\t\tinternal static IEnumerable<string> GetErrorCommentLines(Exception error)\r\n\t\t{\r\n\t\t\tyield return \"ILSpy could not decompile this. Please report the exception below,\";\r\n\t\t\tyield return \"along with the assembly it came from, at \" + DecompilationErrorReportUrl;\r\n\t\t\tforeach (string line in error.ToString().Split('\\n'))\r\n\t\t\t{\r\n\t\t\t\tyield return line.TrimEnd('\\r');\r\n\t\t\t}\r\n\t\t}\r\n\r","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/icsharpcode/ILSpy/blob/60c08fcb74fcc183130f73c861ed35cf944d0bf1/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs#L309-L345","documentation":"Thrown by CSharpDecompiler.GetErrorHeadline(DecompilerException error): error == null -> throw new ArgumentNullException(nameof(error)). The message is the parameter name 'error'. GetErrorHeadline formats a one-line description of a decompiler failure and requires a real exception.","triggerScenarios":"Calling GetErrorHeadline(null) directly, or code that passed a null DecompilerException through to it.","commonSituations":"Internal/UI code path that obtained no exception object (e.g. a decompile list with a null entry) and forwarded it.","solutions":["Pass a non-null DecompilerException to GetErrorHeadline.","Null-check the exception at the call site before formatting the headline."],"exampleFix":"// before\nvar headline = CSharpDecompiler.GetErrorHeadline(maybeNullError);\n\n// after\nvar headline = maybeNullError == null\n    ? \"Decompilation failed.\"\n    : CSharpDecompiler.GetErrorHeadline(maybeNullError);","handlingStrategy":"validation","validationCode":"if (error == null) throw new ArgumentNullException(nameof(error));\nvar headline = CSharpDecompiler.GetErrorHeadline(error);","typeGuard":null,"tryCatchPattern":"var headline = error != null\n    ? CSharpDecompiler.GetErrorHeadline(error)\n    : \"Decompilation failed.\";","preventionTips":["Coalesce null error objects before calling GetErrorHeadline."],"tags":["decompiler","csharp","argument-null"],"backgroundTag":null,"analyzedSha":"60c08fcb74fcc183130f73c861ed35cf944d0bf1","analyzedAt":"2026-08-13T11:34:51.223Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}