Meadow
Meadow copied to clipboard
Debugger and unit test don't work on Windows(similar to #6)
Here are the steps I've done to get here.
- Install VS code(1.33.1)
- Install Net Core(2.2.203)
- Install Solidity Debugger Extension for VS code(0.2.1)
- Create project from Template
- Install SolcNet.Legacy with below command(to support lower version of compiler)
dotnet add package SolcNet.Legacy
- Create launch.json file with content below
{
"version": "0.2.0",
"configurations": [
{
"type": "solidityMeadow",
"request": "launch",
"name": "Debug Solidity (via unit test run)"
}
]
}
- Create a Main.sol with content below
pragma solidity ^0.4.24;
import "./HelloWorld.sol";
contract Main {
constructor () public {
HelloWorld hello = new HelloWorld();
}
}
- Enable below line in app.config
<add key="SolcVersion" value="0.4.24"/>
- Press F5 to start debugging
- Getting an error as below snapshot
- Below is the output I get from running dotnet build
PS D:\code_playground\meadowTest> dotnet build
Microsoft (R) Build Engine for .NET Core 16.0.450+ga8dc7f1d34 版
Copyright (C) Microsoft Corporation. 著作權所有,並保留一切權利。
D:\code_playground\meadowTest\meadowTest.csproj 的還原於 47.05 ms 完成。
SolcNet.Legacy package installed and available for use
Generating code for solidity files
Running: dotnet "C:\Users\stephen\.nuget\packages\meadow.solcodegen\0.3.225\tools\/netcoreapp2.1/any/Meadow.SolCodeGen.dll" --source "D:\code_playground\meadowTest/Contracts" --namespace meadowTest --generate source --legacysolc "C:\Users\stephen\.nuget\packages\solcnet.legacy\0.1.17\build\/../lib/netstandard2.0/SolcNet.Legacy.dll" --solcversion "0.4.24" --solcoptimizer ""
Solidity source directory specified: D:\code_playground\meadowTest\Contracts
Legacy solc lib set: C:\Users\stephen\.nuget\packages\solcnet.legacy\0.1.17\lib\netstandard2.0\SolcNet.Legacy.dll
Solc version specified: 0.4.24
Using native libsolc version 0.4.24+commit.8025b766.mod.Windows.msvc at C:\Users\stephen\.nuget\packages\solcnet.legacy\0.1.17\content\native\v0.4.24\solc.dll
Compiling solidity files in D:/code_playground/meadowTest/Contracts
Compiling solidity completed in 0.26 seconds
Generated sol source file hashes in 0.03 seconds
Writing generated output to directory: D:\code_playground\meadowTest\GeneratedContracts
Skipping writing already up-to-date source file: SolcOutputDataHelper
Skipping writing already up-to-date source file: SolcOutputData
Resx file for solc output generation took: 0 seconds
Detected already up-to-date generated files: 2 contracts
Skipping writing already up-to-date source file: ContractEventLogHelper
Contract and event source code generation took: 0.01 seconds
SolCodeGen completed in: 0.35 seconds
Solidity analysis and code generation process took: 0.35 seconds
meadowTest -> D:\code_playground\meadowTest\bin\Debug\netcoreapp2.1\meadowTest.dll
建置成功。
0 個警告
0 個錯誤
經過時間 00:00:01.50
- And the output I get by running dotnet test(nothing happened)
PS D:\code_playground\meadowTest> dotnet test
PS D:\code_playground\meadowTest> dotnet test
PS D:\code_playground\meadowTest> dotnet test
PS D:\code_playground\meadowTest>
Same here, "convertToDto unexpected type". On VSCode 1.34 / Windows 10. Happens both when opening a single .sol
file and when running using unit tests for the project as a whole.
Compiling within VS Code does seem to work. I get relevant warnings in the output, and when I correct the code they disappear. It's just debugging that doesn't work.
I am able to run unit tests and debug them within Visual Studio 2019 Community.
Reverting to VSCode 1.29 (Oct 2018 release) is a workaround for me. Everything there works as advertised with latest Meadow extension from marketplace. Make sure you disable auto updates or VSCode will very quickly be back to latest version.
I had a hunch this issue was caused by some recent changes in VSCode debugging API as I saw mentions issues, so I tried older releases from around the latest commit to master (Jan 2019) until I found one that worked.
I see some recent commits in the develop branch related to fixing Solidity debugging, so it seems this is being worked on.
For me dotnet test
also gives no output, by the way. But test discovery and run/debug from VS2019 and VSCode (1.29 as workaround) work fine. So that's possibly a separate issue.
I get the same error on VSCode 1.34.0 on macOS, so this issue appears to be cross-platform. It's a showstopper for me; I can't seem to run any Solidity code at all.
Sorry, this issue will be addressed in the coming days. Meadow was not maintained for some months, as it was a project we started at Hosho, before we moved on elsewhere. I didn't want to let this project go, so I've since acquired it with the intention of maintaining it in my spare time.
Currently the master branch is outdated and the VSCode API changed. You can use the develop branch which aims to decouple solc from Meadow (so it uses the solc available on your system instead of including an embedded one). That will offer increased flexibility for different Solidity versions, and require less maintenance moving forward. The develop branch has the required VSCode API updates. After some optimizations are written for the debugger to not be painfully slow, it'll be merged to master and updated packages will be released.
Okay. Thank you for your work on this!