dotnet / try

Try .NET provides developers and content authors with tools to create interactive experiences.
MIT License
2.89k stars 523 forks source link

Bug in dotnet try command ( red area when executing code ) #938

Open abdou31 opened 3 years ago

abdou31 commented 3 years ago

Describe the bug

I'm trying to execute dotnet try to try code samples of this repo but when I'm try run the code, I got this red area without any message.

What can I do in this case????

I really need help to fix this problem because I'm following a Linkedin course that use this tool .

dotnet --version 5.0.203

dotnet --list-sdks 2.1.524 [C:\Program Files\dotnet\sdk] 2.1.700-preview-009618 [C:\Program Files\dotnet\sdk] 3.1.200 [C:\Program Files\dotnet\sdk] 3.1.409 [C:\Program Files\dotnet\sdk] 5.0.203 [C:\Program Files\dotnet\sdk]

dotnet --info SDK .NET (reflétant tous les fichiers global.json) : Version: 5.0.203 Commit: 38xxxx Environnement d'exécution : OS Name: Windows OS Version: 10.0 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.203\

Host (useful for support): Version: 5.0.6 Commit: 478b2f8c0e

.NET SDKs installed: 2.1.524 [C:\Program Files\dotnet\sdk] 2.1.700-preview-009618 [C:\Program Files\dotnet\sdk] 3.1.200 [C:\Program Files\dotnet\sdk] 3.1.409 [C:\Program Files\dotnet\sdk] 5.0.203 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Did this error occur while using dotnet try or online?

What kind of error was it?

Screenshots

image

Please complete the following:

Update: I saw that the problem come from Kaspersky Antivirus, so when I disable the antivirus, the error is gone. But this is not a good solution , I would like to know how can I add an except for the localhost??

Flash0ver commented 3 years ago

I have this issue now as well, where the network tab of my browser says:

{
"exception": "System.AggregateException: One or more errors occurred. (Unsupported log file format. Latest supported version is 9, the log file has version 13.)" ...,
"message": "An unhandled exception occurred."
}

Also, dotnet try verify fails to verify my project:

...
Unhandled exception: System.AggregateException: One or more errors occurred. (Unsupported log file format. Latest supported version is 9, the log file has version 13.)
 ---> System.NotSupportedException: Unsupported log file format. Latest supported version is 9, the log file has version 13.
   at ...

And, I have a déjà vu: I believe I have experienced this error roughly a year ago with "latest supported version 7, but log file has version 9" or similar.

It seems that it worked fine with the .NET Core SDK 3.1.409, but then broke for me after installing the .NET Core SDK 3.1.410. And now it does not work anymore since I have the Microsoft.NETCore.App 3.1.16 runtime installed on my machine. It still works fine on a different machine, where I still have the Microsoft.NETCore.App 3.1.15 runtime installed.

Repo project: https://github.com/Flash0ver/F0-Talks-MutationTesting/tree/main/presentation

jonsequitur commented 3 years ago

Yup, this looks like it's due to a change in the log format for MSBuild. We'll look into whether we can support multiple versions and/or roll forward to .NET 5.

mezJihad commented 3 years ago

I have same probleme, if any one can help please

ssedlak commented 2 years ago

I can't tell if I am missing something or something is wrong that I can't fix. Uncaught (in promise) Error

Untitled1 Untitled

MaartenGDev commented 2 years ago

global.json can be used to fix the log version error.

I used the following steps to fix the "Unsupported log format error":

  1. Install preview version of dotnet try (source: https://github.com/dotnet/try/blob/main/DotNetTryLocal.md)

    dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-try
  2. Clone sample repo

    git clone https://github.com/dotnet/try-samples.git
    cd try-samples
  3. Create global.json inside the try-samples folder

    touch global.json
  4. Place the following contents in global.json in the try-samples folder. Use the latest .NET 3.1 that you have installed (dotnet --list-sdks)

    {
    "sdk": {
    "version": "3.1.416"
    }
    }
  5. Run dotnet try in the try-samples folder:

    dotnet try

The internal server errors should be fixed. Run dotnet try verify if any other error occurs.

ssedlak commented 2 years ago

@MaartenGDev I did everything except I was not able to clone the repo. I tried to just add the json into my existing directory, but still a red box. image

MaartenGDev commented 2 years ago

@ssedlak2278 This error happens if you do not have a SSH key configured in your GitHub profile. You can try cloning using:

git clone https://github.com/dotnet/try-samples.git

You need to follow the steps in https://github.com/dotnet/try/issues/938#issuecomment-1023604536 again after cloning the repository.

ssedlak commented 2 years ago

@MaartenGDev It worked! Thank you. I did have to restart my brower before it worked, probably because I've had it open a week.

Hultner commented 2 years ago

global.json can be used to fix the log version error.

I used the following steps to fix the "Unsupported log format error":

  1. Install preview version of dotnet try (source: https://github.com/dotnet/try/blob/main/DotNetTryLocal.md)
dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-try
  1. Clone sample repo
git clone https://github.com/dotnet/try-samples.git
cd try-samples
  1. Create global.json inside the try-samples folder
touch global.json
  1. Place the following contents in global.json in the try-samples folder. Use the latest .NET 3.1 that you have installed (dotnet --list-sdks)
{
  "sdk": {
    "version": "3.1.416"
  }
}
  1. Run dotnet try in the try-samples folder:
dotnet try

The internal server errors should be fixed. Run dotnet try verify if any other error occurs.

Doesn't help for me, tried in multiple browsers as well. Verify outputs a bunch of errors for me as well.

It would be neat if there were a docker-image with a known working configuration so one could pull and run that image and just run the samples without worrying about problems in local environments.

I run MacOS and have tried in Chrome as well as Safari.

MaartenGDev commented 2 years ago

@Hultner which version of .NET 3.1 do you have installed? Can be checked using dotnet --list-sdks?

Hultner commented 2 years ago

@Hultner which version of .NET 3.1 do you have installed? Can be checked using dotnet --list-sdks?

$ dotnet --list-sdks
2.2.105 [/usr/local/share/dotnet/sdk]
2.2.204 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.416 [/usr/local/share/dotnet/sdk]
6.0.101 [/usr/local/share/dotnet/sdk]

Looks like 3.1.416, which I also added to the global.json file according to your instructions.

cherepo commented 2 years ago

Same error on a Mac (not M1)

2.2.207 [/usr/local/share/dotnet/sdk] 3.1.413 [/usr/local/share/dotnet/sdk] 3.1.416 [/usr/local/share/dotnet/sdk] 5.0.202 [/usr/local/share/dotnet/sdk] 5.0.401 [/usr/local/share/dotnet/sdk] 5.0.405 [/usr/local/share/dotnet/sdk] 6.0.200 [/usr/local/share/dotnet/sdk]

jeremy7710 commented 2 years ago

global.json can be used to fix the log version error.

I used the following steps to fix the "Unsupported log format error":

  1. Install preview version of dotnet try (source: https://github.com/dotnet/try/blob/main/DotNetTryLocal.md)
dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-try
  1. Clone sample repo
git clone https://github.com/dotnet/try-samples.git
cd try-samples
  1. Create global.json inside the try-samples folder
touch global.json
  1. Place the following contents in global.json in the try-samples folder. Use the latest .NET 3.1 that you have installed (dotnet --list-sdks)
{
  "sdk": {
    "version": "3.1.416"
  }
}
  1. Run dotnet try in the try-samples folder:
dotnet try

The internal server errors should be fixed. Run dotnet try verify if any other error occurs.

This works for me, Thanks. I'm on a win10.

vasveone commented 2 years ago

Just added the global.json as advised from @MaartenGDev in my project folder and works fine!

{
  "sdk": {
    "version": "3.1.416"
  }
}
yimaiyan commented 2 years ago

same error in macOS(not M1), as advised from @MaartenGDev in my project folder but failed to fix this issue. Can anyone help? Thanks!

thanh-tran-tien commented 2 years ago

global.json can be used to fix the log version error.

I used the following steps to fix the "Unsupported log format error":

  1. Install preview version of dotnet try (source: https://github.com/dotnet/try/blob/main/DotNetTryLocal.md)
dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-try
  1. Clone sample repo
git clone https://github.com/dotnet/try-samples.git
cd try-samples
  1. Create global.json inside the try-samples folder
touch global.json
  1. Place the following contents in global.json in the try-samples folder. Use the latest .NET 3.1 that you have installed (dotnet --list-sdks)
{
  "sdk": {
    "version": "3.1.416"
  }
}
  1. Run dotnet try in the try-samples folder:
dotnet try

The internal server errors should be fixed. Run dotnet try verify if any other error occurs.

BIG LOVE! BRO

cheema-corellian commented 1 year ago

I followed the instructions in this comment

At first it did not fix my problem. dotnet try verify did not run successfully. The browser still showed red. I then restarted my browser, and the red box in the browser went away. Success!

Here is what my global.json looks like:

{
  "sdk": {
    "version": "7.0.402"
  }
}

For me, it is OK to ignore the dotnet try verify errors, for now.

Godaday commented 3 months ago

This is the process I followed to resolve the error, for your reference.

mkdir mydoc

cd mydoc

dotnet new console -n myApp -f netcoreapp3.1
cd myApp 

create a new file "global.json"

{
  "sdk": {
    "version": "3.1.416"
  }
}

in file version node content look your local sdk list

dotnet --list-sdks
 cd mydoc

create file doc.md

# My Interactive Document:

```cs --source-file ./myApp/Program.cs --project ./myApp/myApp.csproj
```shell
dotnet try verify
dotnet try

image

it's worked