bytecodealliance / wasmtime-dotnet

.NET embedding of Wasmtime https://bytecodealliance.github.io/wasmtime-dotnet/
Apache License 2.0
409 stars 52 forks source link

📝Ensure example deploy required file for local execution #311

Open fforjan opened 3 months ago

fforjan commented 3 months ago

The different example would work if run via dottest run as the local folder would be the one containing the wat file but if run from the binary folder, it would fail as the file woudl be missing.

This is fixing it.

jsturtevant commented 2 months ago

@fforjan what do you mean by but if run from the binary folder?

fforjan commented 2 months ago

@jsturtevant Execution with dotnet run :

PS C:\git\wasmtime-dotnet\examples\consumefuel> dotnet run
Added 5000 units of fuel
Called an expensive function which consumed 1000 fuel. 3998 units of fuel remaining.
Called an expensive function which consumed 1000 fuel. 2996 units of fuel remaining.
Called an expensive function which consumed 1000 fuel. 1994 units of fuel remaining.
Called an expensive function which consumed 1000 fuel. 992 units of fuel remaining.
Calling the expensive function one more time, which will throw an exception.
Exception caught with the following message:
error while executing at wasm backtrace:
    0:   0x36 - <unknown>!expensive

Caused by:
    Arithmetic operation resulted in an overflow.

which is expected.

'local execution' :

PS C:\git\wasmtime-dotnet\examples\consumefuel\bin\Debug\net8.0> .\consumefuel.exe
Unhandled exception. System.IO.FileNotFoundException: Could not find file 'C:\git\wasmtime-dotnet\examples\consumefuel\bin\Debug\net8.0\consumefuel.wat'.

the file is missing because not in the active folder ?

fforjan commented 2 months ago

if I was trying to debug from visual studio : image

fforjan commented 1 month ago

@jsturtevant let me know if you would like me to do anything on this

jsturtevant commented 1 month ago

nothing yet, will get to taking a look at this and a few of the other PRs by end of the week. Thanks for the patience!