AvaloniaUI/AvaloniaVS

"No executable found" when integrating Microsoft.ML.OnnxRuntime.DirectML

llfab opened this issue · 8 comments

Describe the bug

When I have integrated a reference to DirectML using
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.17.3" Condition="'$(Configuration)' != 'Debug'" />
the previewer fails with "No executable found".
image

The Log is as follows:
image

When I switch to Debug (where DirectML is deactivated), close the last xaml document and re-open the xaml document, the previewer works with the following output:
image

This may be due to DirectML being Windows only. Potentially, that changes the Runtime Identifier or TargetPlatformIdentifier under the hood causing the previewer execution detection to fail.

To Reproduce

As above integrate DirectML, rebuild and re-open xaml file

AvaloniaVS plugin version

11.5

Avalonia version

11.0.10

Visual Studio version

17.9.6

Relevant log output

08:30:11.667 [Information]  Stopping previewer process
08:30:13.381 [Error]  No executable found
08:30:17.100 [Information] 0 Stopping previewer process
08:30:17.186 [Error]  No executable found
08:30:19.955 [Information] 0 Stopping previewer process
08:30:20.032 [Error]  No executable found

Additional context

No response

Debugging the VS extension shows that when DirectML is referenced the project is not detected as valid executable project:
image

because the .IsExecutable is false:
image

This is not the case if DirectML is not referenced.

Double checking the same project with the Rider extension works both in Debug and Release, hence, with DirectML referenced and not referenced.

This works.
image

Not sure if you really need to check if the project IsExecutable()...

Added a sample app here: https://github.com/llfab/Samples/tree/main/FailedPreviewer

Works in Debug because DirectML nuget package is only referenced in Release.

  • Close last xaml file
  • Switch to Release
  • Open xaml file => No executable found

The root cause problem is that the Properties list is empty for the exe project:
image

Therefore, the project is not detected as the executable project

Filed an issue here: microsoft/onnxruntime#20574

<ItemGroup>
    <PackageReference Include="microsoft.ai.directml" Version="1.15.2" Condition="'$(Configuration)' != 'Debug'" GeneratePathProperty="True" />
      <PropertyPageSchema Remove="$(PkgMicrosoft_AI_DirectML)/**/*.*" />
</ItemGroup>

Will fix the previewer, note thatGeneratePathProperty is important.

Since it's a VS bug, I'm closing the issue

<ItemGroup>
    <PackageReference Include="microsoft.ai.directml" Version="1.15.2" Condition="'$(Configuration)' != 'Debug'" GeneratePathProperty="True" />
      <PropertyPageSchema Remove="$(PkgMicrosoft_AI_DirectML)/**/*.*" />
</ItemGroup>

Will fix the previewer, note thatGeneratePathProperty is important.

Since it's a VS bug, I'm closing the issue

Nice, we will try out...