Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debuggin Blazor Webassembly project of Visual Studio 2022 does not work correctly with a Visual Basic Library .NET 6 or .NET Standard Project containing Async method. #77481

Closed
1 task done
ivoryguard opened this issue Oct 26, 2022 · 6 comments · Fixed by #78651
Assignees
Milestone

Comments

@ivoryguard
Copy link

ivoryguard commented Oct 26, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Debugging function of Blazor Webassembly project (like watching variable values/evaluating in Immediate window) of Visual Studio 2022 does not work correctly with referencing a Visual Basic Library .NET 6 or .NET Standard Project containing Async method.

All debuging functions except breaking point in async methods in Visual Basic Library .NET 6 or .NET Standard Project, which is referred to C# Blazor WebAssembly project, do not work with the following message in Locals window;

Error processing variables: TypeError: Cannot read properties of undefined (reading 'subtype')
    at Object.isArray (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\objectPreview\index.js:58:19)
    at I.createVariableByType (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:114:27)
    at Q.getChildren (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:659:45)
    at process.children (node:internal/process/task_queues:96:5)
    at n._a [as getVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:783:15)
    at j.result [as _onVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\debugAdapter.js:269:30)
    at t.default._onMessage (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\dap\connection.js:145:27)

However, debugging functions in other non-async methods in Visual Basic Library .NET 6 or .NET Standard Project work correctly.

I updated Visual Studio 2022 up to the latest version (17.3.6) and updated all nuget packages.
I also deleted obj/bin folders and did clean->rebuilding, but it did not disappeared.

I am attaching Locals Window screen shots for calling non-async method and asycn method.

The following is for none-async method;
ScreenCapture 3518

The following is for async method;
ScreenCapture 3519

The issue occurs for Visual Basic .NET Standard Library Project as well as Visual Basic .NET 6 library project.
It makes hard to develop Blazor WebAssembly apps with existing Visual Basic .NET Standard/.NET6 Library projects which utilize async keyword.

Expected Behavior

All debugging functions - watching local variables and evaluating Immediate Window - must work with async method in referred Visual Basic Library Projects.

Steps To Reproduce

  1. Open Visual Studio 2022

  2. Create a Blazor WebAssembly Project (C# .NET 6) without ASP.NET Core Hosting

  3. Add a Visual Basic Library Project (.NET 6 or .NET Standard 2.0/2.1)

  4. Add project reference of Visual Basic Library Project to Blazor WebAssembly Project

  5. Add a Class to Visual Basic Library Project as the followings;

Public Class TestService
    Public Function Test(data As String) As String
        Return data
    End Function

    Public Async Function TestAsync(data As String) As Task(Of String)
        Await Task.Delay(10)
        Return data
    End Function

End Class
  1. Modify Program.cs of Blazor WebAssembly Project as the followings;
using BlazorApp1;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

//To call VB Library Project methods
var testService = new ClassLibrary1.TestService();
var result = testService.Test("1234");
var resultAsync = await testService.TestAsync("1234");

await builder.Build().RunAsync();
  1. Add a break point at the line of 'var result = testService.Test("1234");'

  2. Start Blazor WebAssembly Project and debug into testService.Test and await testService.TestAsync.

  3. You can see "data" variable value in Auto/Locals window in TestService.Test method.

  4. You cannot see "data" variable value in Auto/Locals window in TestService.TestAsync method.

Exceptions (if any)

		Error processing variables: TypeError: Cannot read properties of undefined (reading 'subtype')
at Object.isArray (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\objectPreview\index.js:58:19)
at I.createVariableByType (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:114:27)
at Q.getChildren (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:659:45)
at process.children (node:internal/process/task_queues:96:5)
at n._a [as getVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:783:15)
at j.result [as _onVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\debugAdapter.js:269:30)
at t.default._onMessage (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\dap\connection.js:145:27)	

.NET Version

6.0.402

Anything else?

Test Envrionment:
Windows 10
Visual Studio 2022
.NET 6 Blazor WebAssembly Project Template

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>dotnet --info
.NET SDK:
 Version:   6.0.402
 Commit:    6862418796

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.402\

global.json file:
  Not found

Host:
  Version:      6.0.10
  Architecture: x64
  Commit:       5a400c212a

.NET SDKs installed:
  5.0.214 [C:\Program Files\dotnet\sdk]
  5.0.303 [C:\Program Files\dotnet\sdk]
  5.0.408 [C:\Program Files\dotnet\sdk]
  6.0.402 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.30 [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 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.30 [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 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
@javiercn javiercn transferred this issue from dotnet/aspnetcore Oct 26, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Oct 26, 2022
@ghost
Copy link

ghost commented Oct 26, 2022

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Debugging function of Blazor Webassembly project (like watching variable values/evaluating in Immediate window) of Visual Studio 2022 does not work correctly with referencing a Visual Basic Library .NET 6 or .NET Standard Project containing Async method.

All debuging functions except breaking point in async methods in Visual Basic Library .NET 6 or .NET Standard Project, which is referred to C# Blazor WebAssembly project, do not work with the following message in Locals window;

Error processing variables: TypeError: Cannot read properties of undefined (reading 'subtype')
    at Object.isArray (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\objectPreview\index.js:58:19)
    at I.createVariableByType (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:114:27)
    at Q.getChildren (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:659:45)
    at process.children (node:internal/process/task_queues:96:5)
    at n._a [as getVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:783:15)
    at j.result [as _onVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\debugAdapter.js:269:30)
    at t.default._onMessage (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\dap\connection.js:145:27)

However, debugging functions in other non-async methods in Visual Basic Library .NET 6 or .NET Standard Project work correctly.

I updated Visual Studio 2022 up to the latest version (17.3.6) and updated all nuget packages.
I also deleted obj/bin folders and did clean->rebuilding, but it did not disappeared.

I am attaching Locals Window screen shots for calling non-async method and asycn method.

The following is for none-async method;
ScreenCapture 3518

The following is for async method;
ScreenCapture 3519

The issue occurs for Visual Basic .NET Standard Library Project as well as Visual Basic .NET 6 library project.
It makes hard to develop Blazor WebAssembly apps with existing Visual Basic .NET Standard/.NET6 Library projects which utilize async keyword.

Expected Behavior

All debugging functions - watching local variables and evaluating Immediate Window - must work with async method in referred Visual Basic Library Projects.

Steps To Reproduce

  1. Open Visual Studio 2022

  2. Create a Blazor WebAssembly Project (C# .NET 6) without ASP.NET Core Hosting

  3. Add a Visual Basic Library Project (.NET 6 or .NET Standard 2.0/2.1)

  4. Add project reference of Visual Basic Library Project to Blazor WebAssembly Project

  5. Add a Class to Visual Basic Library Project as the followings;

Public Class TestService
    Public Function Test(data As String) As String
        Return data
    End Function

    Public Async Function TestAsync(data As String) As Task(Of String)
        Await Task.Delay(10)
        Return data
    End Function

End Class
  1. Modify Program.cs of Blazor WebAssembly Project as the followings;
using BlazorApp1;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

//To call VB Library Project methods
var testService = new ClassLibrary1.TestService();
var result = testService.Test("1234");
var resultAsync = await testService.TestAsync("1234");

await builder.Build().RunAsync();
  1. Add a break point at the line of 'var result = testService.Test("1234");'

  2. Start Blazor WebAssembly Project and debug into testService.Test and await testService.TestAsync.

  3. You can see "data" variable value in Auto/Locals window in TestService.Test method.

  4. You cannot see "data" variable value in Auto/Locals window in TestService.TestAsync method.

Exceptions (if any)

		Error processing variables: TypeError: Cannot read properties of undefined (reading 'subtype')
at Object.isArray (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\objectPreview\index.js:58:19)
at I.createVariableByType (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:114:27)
at Q.getChildren (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:659:45)
at process.children (node:internal/process/task_queues:96:5)
at n._a [as getVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\variableStore.js:783:15)
at j.result [as _onVariables] (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\adapter\debugAdapter.js:269:30)
at t.default._onMessage (c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\jsdiagnostics\debugger\debugAdapter\out\src\dap\connection.js:145:27)	

.NET Version

6.0.402

Anything else?

Test Envrionment:
Windows 10
Visual Studio 2022
.NET 6 Blazor WebAssembly Project Template

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>dotnet --info
.NET SDK:
 Version:   6.0.402
 Commit:    6862418796

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.402\

global.json file:
  Not found

Host:
  Version:      6.0.10
  Architecture: x64
  Commit:       5a400c212a

.NET SDKs installed:
  5.0.214 [C:\Program Files\dotnet\sdk]
  5.0.303 [C:\Program Files\dotnet\sdk]
  5.0.408 [C:\Program Files\dotnet\sdk]
  6.0.402 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.30 [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 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.30 [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 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Author: ivoryguard
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

@lewing lewing added this to the 8.0.0 milestone Oct 26, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Oct 26, 2022
@ivoryguard
Copy link
Author

Is there any solution or workaround for current .NET 6 and Visual Studio 2022? Do I have nothing but to convert existing VB.NET Library codes to C#?

@thaystg
Copy link
Member

thaystg commented Nov 22, 2022

image

@thaystg
Copy link
Member

thaystg commented Nov 22, 2022

I think this is fixed, or I'm missing something to reproduce.
@ivoryguard can you test it again using the newest Visual Studio?

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Nov 22, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Nov 29, 2022
@ivoryguard
Copy link
Author

I think this is fixed, or I'm missing something to reproduce. @ivoryguard can you test it again using the newest Visual Studio?

I updated to v17.4.3 and could see local variables in Local Window at VB.NET
However, mouse tooltip on a variable does not show its value;
It works with C# .NET Standard project but it does not work with VB.NET .NET Standard project.

So, it is not fixed completely.

Using library project is only way to use VB.NET at Blazor WASM though it is partial solution.
So, it must be improved more.

@thaystg
Copy link
Member

thaystg commented Dec 26, 2022

Can you provide us a sample project where I can reproduce it?

@ghost ghost locked as resolved and limited conversation to collaborators Jan 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants