Meadow icon indicating copy to clipboard operation
Meadow copied to clipboard

Debugger and unit test don't work on Windows(similar to #6)

Open stephenctw opened this issue 5 years ago • 6 comments

Here are the steps I've done to get here.

  1. Install VS code(1.33.1)
  2. Install Net Core(2.2.203)
  3. Install Solidity Debugger Extension for VS code(0.2.1)
  4. Create project from Template
  5. Install SolcNet.Legacy with below command(to support lower version of compiler)
dotnet add package SolcNet.Legacy
  1. Create launch.json file with content below
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "solidityMeadow",
            "request": "launch",
            "name": "Debug Solidity (via unit test run)"
        }
    ]
}
  1. Create a Main.sol with content below
pragma solidity ^0.4.24;

import "./HelloWorld.sol";

contract Main {

    constructor () public {
        HelloWorld hello = new HelloWorld();
    }

}
  1. Enable below line in app.config
<add key="SolcVersion" value="0.4.24"/>
  1. Press F5 to start debugging
  2. Getting an error as below snapshot image
  3. 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
  1. 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>

stephenctw avatar May 13 '19 10:05 stephenctw

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.

AronVanAmmers avatar May 17 '19 16:05 AronVanAmmers

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.

AronVanAmmers avatar May 18 '19 10:05 AronVanAmmers

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.

AronVanAmmers avatar May 18 '19 14:05 AronVanAmmers

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.

mcoblenz avatar May 30 '19 18:05 mcoblenz

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.

Xenomega avatar Jun 02 '19 21:06 Xenomega

Okay. Thank you for your work on this!

mcoblenz avatar Jun 04 '19 20:06 mcoblenz