Repository navigation
Description
Description
When publishing a self-contained application with PublishReadyToRun=true, crossgen2 throws Input file with '.DLL' extension not supported if the input assembly's path ends with an uppercase extension. This happens on filesystems where the actual on-disk filename is returned in uppercase (for example, a WinFsp/virtiofs share on Windows that normalizes names to uppercase).
Repro steps
- On Windows, place a
net10.0console project on a virtiofs/WinFsp share that returns files with uppercase extensions (sodir /xshowsBBS.CMD.DLLinstead ofBbs.Cmd.dll). - Publish with ReadyToRun enabled:
dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=true- The build fails during the R2R step.
Expected behavior
crossgen2 should treat .DLL, .Dll, .EXE, etc. as valid managed-assembly extensions, just like earlier versions did.
Actual behavior
Build fails with:
Microsoft.NET.CrossGen.targets(467,5): error : Error: Input file with '.DLL' extension not supported
System.CommandLine.CommandLineException: Input file with '.DLL' extension not supported
at ILCompiler.Program.RunSingleCompilation(...)
Regression
This is a regression from Microsoft.NETCore.App.Crossgen2.win-x64 10.0.5 → 10.0.9 (and still present in main as of today).
10.0.5 accepts uppercase .DLL/.EXE inputs; 10.0.9 rejects them.
Root cause
In src/coreclr/tools/aot/crossgen2/Program.cs, RunSingleCompilation does a case-sensitive extension check:
string inputFileExtension = Path.GetExtension(inFilePath);
string nearOutFilePath = inputFileExtension switch
{
".dll" => Path.ChangeExtension(inFilePath,
_singleFileCompilation && _inputBubble
? ".ni.dll.tmp"
: ".ni.dll"),
".exe" => Path.ChangeExtension(inFilePath,
_singleFileCompilation && _inputBubble
? ".ni.exe.tmp"
: ".ni.exe"),
_ => throw new CommandLineException(string.Format(SR.UnsupportedInputFileExtension, inputFileExtension))
};Path.GetExtension preserves the casing of the actual file on disk. On a case-insensitive filesystem that returns uppercase names, the extension is .DLL/.EXE, which does not match .dll/.exe.
Proposed fix
Make the extension check case-insensitive, e.g.:
string nearOutFilePath = inputFileExtension.ToLowerInvariant() switch
{
".dll" => ...,
".exe" => ...,
_ => throw ...
};or compare with StringComparer.OrdinalIgnoreCase.
Environment
- .NET SDK:
10.0.301 - Runtime / crossgen2 package:
Microsoft.NETCore.App.Crossgen2.win-x6410.0.9 - OS: Windows 11
- Filesystem: WinFsp-backed virtiofs share with case-insensitive name normalization
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
Fix crossgen2 rejecting input files with uppercase .DLL/.EXE extensio…