Can't debug WASM with code behind components #20

Closed
opened 2026-01-29 17:30:15 +00:00 by claunia · 3 comments
Owner

Originally created by @devlife on GitHub (Jan 25, 2021).

Describe the bug
When using RadzenButton, no break points are being hit when using a code behind (ie. MyComponent.razor.cs) instead of having the C# code directly in the razor file in Blazor WASM.

To Reproduce
Steps to reproduce the behavior:

  1. Create MyComponent.razor and add the following code to a razor file:
    <RadzenButton @onclick="IncrementCount" Text="@CurrentCount.ToString()"></RadzenButton>
  2. Create MyComponent.razor.cs, make it partial
  3. Add the following code to MyComponent.razor.cs
public int CurrentCount { get; set; } = 1;

public void IncrementCount(MouseEventArgs e)
{
    CurrentCount++;
}
  1. Set a break point in IncrementCount
  2. Debug the wasm app and navigate to a page containing your component
  3. Click the Button
  4. Note that the breakpoint is not being hit
  5. Change the code in the razor file to the following
    <button @onclick="IncrementCount">@CurrentCount.ToString()</button>
  6. Debug, click the button, note that the break point is hit

Expected behavior
I would expect to be able to hit a break point using Radzen components when using a code behind cs file.

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • Browser Edge
  • Version 88.0.705.50
  • Visual Studio 2019 16.8.4

Additional context
I also tried in Visual Studio 2019 Preview.

Originally created by @devlife on GitHub (Jan 25, 2021). **Describe the bug** When using RadzenButton, no break points are being hit when using a code behind (ie. `MyComponent.razor.cs`) instead of having the C# code directly in the razor file in Blazor WASM. **To Reproduce** Steps to reproduce the behavior: 1. Create `MyComponent.razor` and add the following code to a razor file: `<RadzenButton @onclick="IncrementCount" Text="@CurrentCount.ToString()"></RadzenButton>` 2. Create `MyComponent.razor.cs`, make it `partial` 3. Add the following code to `MyComponent.razor.cs` ``` public int CurrentCount { get; set; } = 1; public void IncrementCount(MouseEventArgs e) { CurrentCount++; } ``` 4. Set a break point in `IncrementCount` 5. Debug the wasm app and navigate to a page containing your component 6. Click the Button 7. Note that the breakpoint is not being hit 8. Change the code in the razor file to the following `<button @onclick="IncrementCount">@CurrentCount.ToString()</button>` 9. Debug, click the button, note that the break point is hit **Expected behavior** I would expect to be able to hit a break point using Radzen components when using a code behind cs file. **Desktop (please complete the following information):** - OS: Windows 10 Pro - Browser Edge - Version 88.0.705.50 - Visual Studio 2019 16.8.4 **Additional context** I also tried in Visual Studio 2019 Preview.
Author
Owner

@akorchev commented on GitHub (Jan 26, 2021):

Try with Click as in our online demo.

<RadzenButton Click=@IncrementCount />
@akorchev commented on GitHub (Jan 26, 2021): Try with `Click` as in our online demo. ``` <RadzenButton Click=@IncrementCount /> ```
Author
Owner

@devlife commented on GitHub (Feb 3, 2021):

I thought I did try that but I will try it again and let you know.

@devlife commented on GitHub (Feb 3, 2021): I thought I did try that but I will try it again and let you know.
Author
Owner

@devlife commented on GitHub (Feb 3, 2021):

That did it. It appears that there is quite a delay between when the app loads and when the debugger is ready to hit a breakpoint!

@devlife commented on GitHub (Feb 3, 2021): That did it. It appears that there is quite a delay between when the app loads and when the debugger is ready to hit a breakpoint!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#20