AvaloniaUI / AvaloniaVS

Visual Studio Extension for Avalonia
MIT License
409 stars 77 forks source link

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

Open llfab opened 2 months ago

llfab commented 2 months ago

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

llfab commented 2 months ago

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.

llfab commented 2 months ago

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

llfab commented 2 months ago

This works. image

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

llfab commented 2 months ago

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.

llfab commented 2 months ago

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

llfab commented 2 months ago

Filed an issue here: https://github.com/microsoft/onnxruntime/issues/20574