-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
arch-s390xRelated to s390x architecture (unsupported)Related to s390x architecture (unsupported)area-HostModelMicrosoft.NET.HostModel issuesMicrosoft.NET.HostModel issues
Milestone
Description
Using a .NET 8 RC 1 SDK compiled on s390x with #90292 applied locally, dotnet tool install -g dotnet-ef fails:
$ dotnet tool install -g dotnet-ef
Unhandled exception: Microsoft.NET.HostModel.AppHost.AppHostNotPEFileException: Selected apphost is not a valid PE file. Subsystem offset out of file range.
at Microsoft.NET.HostModel.AppHost.PEUtils.GetWindowsGraphicalUserInterfaceBit(MemoryMappedViewAccessor accessor)
at Microsoft.NET.HostModel.AppHost.PEUtils.GetWindowsGraphicalUserInterfaceBit(String filePath)
at Microsoft.DotNet.ShellShim.AppHostShellShimMaker.CreateApphostShellShim(FilePath entryPoint, FilePath shimPath)
at Microsoft.DotNet.ShellShim.ShellShimRepository.<>c__DisplayClass5_0.<CreateShim>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.<>c__DisplayClass5_0.<Run>b__0()
at Microsoft.DotNet.Cli.TransactionalAction.Run[Object](Func`1 action, Action commit, Action rollback)
at Microsoft.DotNet.Cli.TransactionalAction.Run(Action action, Action commit, Action rollback)
at Microsoft.DotNet.ShellShim.ShellShimRepository.CreateShim(FilePath targetExecutablePath, ToolCommandName commandName, IReadOnlyList`1 packagedShims)
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
at Microsoft.DotNet.Tools.Tool.Install.ToolInstallCommand.Execute()
at Microsoft.DotNet.Cli.ToolInstallCommandParser.<>c.<ConstructCommand>b__17_0(ParseResult parseResult)
at System.CommandLine.Invocation.AnonymousCliAction.Invoke(ParseResult parseResult)
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
at System.CommandLine.ParseResult.Invoke()
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
The stack trace suggests this is the culprit:
runtime/src/installer/managed/Microsoft.NET.HostModel/AppHost/PEUtils.cs
Lines 114 to 142 in 32c3355
| internal static unsafe ushort GetWindowsGraphicalUserInterfaceBit(MemoryMappedViewAccessor accessor) | |
| { | |
| byte* pointer = null; | |
| try | |
| { | |
| accessor.SafeMemoryMappedViewHandle.AcquirePointer(ref pointer); | |
| byte* bytes = pointer + accessor.PointerOffset; | |
| // https://en.wikipedia.org/wiki/Portable_Executable | |
| uint peHeaderOffset = ((uint*)(bytes + PEOffsets.DosStub.PESignatureOffset))[0]; | |
| if (accessor.Capacity < peHeaderOffset + PEOffsets.PEHeader.Subsystem + sizeof(ushort)) | |
| { | |
| throw new AppHostNotPEFileException("Subsystem offset out of file range."); | |
| } | |
| ushort* subsystem = ((ushort*)(bytes + peHeaderOffset + PEOffsets.PEHeader.Subsystem)); | |
| return subsystem[0]; | |
| } | |
| finally | |
| { | |
| if (pointer != null) | |
| { | |
| accessor.SafeMemoryMappedViewHandle.ReleasePointer(); | |
| } | |
| } | |
| } |
Probably an endianness issue?
Metadata
Metadata
Assignees
Labels
arch-s390xRelated to s390x architecture (unsupported)Related to s390x architecture (unsupported)area-HostModelMicrosoft.NET.HostModel issuesMicrosoft.NET.HostModel issues
Type
Projects
Status
No status