Closed shyamnamboodiripad closed 2 months ago
This error also causes an initialization failure when opening the http editor in VS if I switch it over to use the latest builds of the dotnet-interactive tool.
Can you provide an example?
In the http editor case, the very first command that is executed when a http file is opened invariably results in a CommandFailed
with the above error message (see log below). This is the command that registers the formatter for the response viewer and currently, the http editor bails with an exception (and refuses to execute any requests) when this initial command fails.
[2:36:18 PM Trace] 2024-07-29T21:36:18.0711028Z [|7c9f7d2c-48d5f2f6fbc5789e.] [KernelInvocationContext] [KernelInvocationContext] ▶ +[ ⁞Ϲ⁞ SubmitCode #r "Microsoft.DotNet.Interactive.Http" ... (Token: CvkEHuSc0U2J9vdmXZEYUQ==, TargetKernelName: , DestinationUri: ) ]
[2:36:18 PM Trace] 2024-07-29T21:36:18.0711028Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] [KernelScheduler] [Run] ▶ +[ ⁞Ϲ⁞ SubmitCode #r "Microsoft.DotNet.Interactive.Http" ... (Token: CvkEHuSc0U2J9vdmXZEYUQ==, TargetKernelName: csharp, DestinationUri: kernel://51208-69ac5526-5e7f-41b5-a71f-79ad87b88218/csharp) ]
[2:36:18 PM Trace] 2024-07-29T21:36:18.0711028Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ➡️ SubmitCode kernel://local/local-composite (arrived)
[2:36:18 PM Trace] 2024-07-29T21:36:18.0711028Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ➡️ SubmitCode kernel://local/csharp (arrived)
[2:36:18 PM Trace] 2024-07-29T21:36:18.1097522Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ CodeSubmissionReceived kernel://local/csharp
[2:36:18 PM Trace] 2024-07-29T21:36:18.1097522Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ CodeSubmissionReceived kernel://local/local-composite
[2:36:18 PM Trace] 2024-07-29T21:36:18.1343997Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ CompleteCodeSubmissionReceived kernel://local/csharp
[2:36:18 PM Trace] 2024-07-29T21:36:18.1343997Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ CompleteCodeSubmissionReceived kernel://local/local-composite
[2:36:18 PM Trace] 2024-07-29T21:36:18.7846154Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ DiagnosticsProduced kernel://local/csharp
[2:36:18 PM Trace] 2024-07-29T21:36:18.7846154Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ DiagnosticsProduced kernel://local/local-composite
[2:36:18 PM Trace] 2024-07-29T21:36:18.7846154Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ DiagnosticsProduced kernel://local/csharp
[2:36:18 PM Trace] 2024-07-29T21:36:18.7846154Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ⬅️ DiagnosticsProduced kernel://local/local-composite
[2:36:18 PM Trace] 2024-07-29T21:36:18.7971204Z ℹ ⁞Ε⁞ CommandFailed (2,4): error DNI210: Unable to parse package refer ... (Command: SubmitCode, Token: CvkEHuSc0U2J9vdmXZEYUQ==)
[2:36:18 PM Trace] 2024-07-29T21:36:18.7971204Z ℹ ⬅️ CommandFailed kernel://local/csharp
[2:36:18 PM Trace] 2024-07-29T21:36:18.7971204Z ℹ ⬅️ CommandFailed kernel://local/local-composite
[2:36:18 PM Trace] 2024-07-29T21:36:18.7971204Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ➡️ SubmitCode kernel://local/csharp
[2:36:18 PM Trace] 2024-07-29T21:36:18.7971204Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] ℹ ➡️ SubmitCode kernel://local/local-composite
[2:36:18 PM Trace] 2024-07-29T21:36:18.7971204Z [|7c9f7d2c-48d5f2f6fbc5789e.] [KernelInvocationContext] [KernelInvocationContext] ⏹ (721.4617ms)
[2:36:18 PM Trace] 2024-07-29T21:36:18.7971204Z [|7c9f7d2c-48d5f2f6fbc5789e.1.] [KernelScheduler] [Run] ⏹ -> ✔ (721.019ms)
After debugging looks like the root cause is because over here #r "<assembly path>"
ends up being parsed as #r "nuget:<package>"
if <assembly path>
happens to contain the string nuget
(which is common in the case where the assembly being referenced lives under the user's .nuget
folder).
This is not a race as initially imagined - a simpler repro involves executing the following command in a notebook cell:
#r "C:/Users/<username>/.nuget/packages/microsoft.dotnet-interactive/1.0.537401/tools/net8.0/any/Microsoft.DotNet.Interactive.Jupyter.dll"
I think the reason this may have seemed like a race that is only reproducible on release bits may be because when we test with debug bits, Microsoft.DotNet.Interactive.Jupyter.dll
above is usually resolved from under the build output folder as opposed to from under the .nuget folder. Consequently, this (deferred) command that adds a reference to Microsoft.DotNet.Interactive.Jupyter.dll
would succeed on debug bits but always fail on release bits.
Very good find!
We are occasionally running into this error when executing notebook cells in latest internal preview bits:
The issue is a race and based on some debugging that @jonsequitur has been doing, the race only seems to repro on release bits.
We have a suspicion that this only happens if we try to execute a cell soon after a notebook is opened / soon after restarting kernels. However, iirc I also ran into it a couple of times after waiting for 1 minute+ after opening a notebook.
This error also causes an initialization failure when opening the http editor in VS if I switch it over to use the latest builds of the dotnet-interactive tool.