{"record":{"id":"c8a9e6842bf8d922","repo":"dotnet/BenchmarkDotNet","slug":"unsupported-extension-on-source-source-must-h","errorCode":null,"errorMessage":"Unsupported extension on source '{source}', must have the extension '.dll' or '.exe'.","messagePattern":"Unsupported extension on source '(.+?)', must have the extension '\\.dll' or '\\.exe'\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet.TestAdapter/VSTestAdapter.cs","lineNumber":241,"sourceCode":"            var appDomain = AppDomain.CreateDomain(domainName, null, setup);\n            return appDomain.CreateInstanceAndUnwrap(\n                type.Assembly.FullName, type.FullName, false, BindingFlags.Default, null, null, null, null);\n#else\n            return Activator.CreateInstance(type);\n#endif\n        }\n\n        private static void ValidateSourceIsAssemblyOrThrow(string source)\n        {\n            if (string.IsNullOrEmpty(source))\n                throw new ArgumentException($\"'{nameof(source)}' cannot be null or whitespace.\", nameof(source));\n\n            if (!Path.HasExtension(source))\n                throw new NotSupportedException($\"Missing extension on source '{source}', must have the extension '.dll' or '.exe'.\");\n\n            var extension = Path.GetExtension(source);\n            if (!string.Equals(extension, \".dll\", StringComparison.OrdinalIgnoreCase) && !string.Equals(extension, \".exe\", StringComparison.OrdinalIgnoreCase))\n                throw new NotSupportedException($\"Unsupported extension on source '{source}', must have the extension '.dll' or '.exe'.\");\n        }\n    }\n}\n","sourceCodeStart":223,"sourceCodeEnd":245,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet.TestAdapter/VSTestAdapter.cs#L223-L245","documentation":"ValidateSourceIsAssemblyOrThrow throws NotSupportedException when the source has an extension but it is neither '.dll' nor '.exe' (case-insensitive). The adapter can only load managed benchmark assemblies of those two types.","triggerScenarios":"Source is a file with some other extension, e.g. 'MyBenchmarks.exe.config', 'MyBenchmarks.pdb', 'MyBenchmarks.json', or a script/.csproj passed by mistake.","commonSituations":"Forwarding a build artifact that is not the assembly (.pdb, .config, .json sidecar); pointing at a .csproj instead of the build output; tooling that resolves to a wrong file in the output directory.","solutions":["Pass the assembly file specifically (.dll or .exe), not a sibling artifact.","When enumerating build output, filter for the assembly extension rather than the first matching file.","Fix the path resolution in the calling test platform/tooling."],"exampleFix":"// before\nvar source = \"bin/Debug/net8.0/MyBenchmarks.pdb\"; // wrong artifact\n\n// after\nvar source = \"bin/Debug/net8.0/MyBenchmarks.dll\";","handlingStrategy":"validation","validationCode":"static string RequireAssemblyExtension(string source)\n{\n    var ext = Path.GetExtension(source);\n    if (!ext.Equals(\".dll\", StringComparison.OrdinalIgnoreCase) &&\n        !ext.Equals(\".exe\", StringComparison.OrdinalIgnoreCase))\n        throw new ArgumentException($\"source '{source}' must end in .dll/.exe\", nameof(source));\n    return source;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Forward the assembly file specifically, not sibling artifacts (.pdb/.config/.json).","When scanning build output, filter for the assembly extension.","Validate the resolved path before handing it to the adapter."],"tags":["benchmarkdotnet","testadapter","vstest","validation","source-path"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}