Infinite loop in RadzenGrid when RowSelect is specified

I am experiencing a very similar behavior as already described in

If a RadzenGrid which has specified the RowSelect event-callback is inside a RadzenTabs and some tabs are enclosed by AuthorizeView.Role the infinite loop occurs.

Please see the simple example code below

Please note, if the RowSelected callback is not specified or the 'Users' tab is not enclosed by AuthorizeView everything works fine and the infinite loop does not occur.

@page "/"

@using Radzen;
@using Radzen.Blazor;
@using Semafor.View.Authentication;

@namespace Semafor.View.Ambulances.Patients_

@inject AuthenticationStateProvider myAuthenticationStateProvider;

        <h1>Semafor Login</h1>
            <RadzenLogin AllowRegister="false" AllowResetPassword="false" Login="@OnLogin" />
    <Authorized Context="Context1">
        <div class="container">
                    <RadzenTabsItem Text="Patients">
                        <div class="row">
                            <div class="col">
                                <RadzenGrid AllowPaging="true" PageSize="100" AllowSorting="true" AllowFiltering="true"
                                            Data="@myViewModel.Patients" TItem="Patient2" Value="@myViewModel.SelectedPatient"
                                        <RadzenGridColumn TItem="Patient2" Property="@nameof(Patient2.FirstName)" Title="First Name" />
                                        <RadzenGridColumn TItem="Patient2" Property="@nameof(Patient2.LastName)" Title="Last Name" />
                    <AuthorizeView Roles="Role1">
                        <RadzenTabsItem Text="Users">

@code {
    public class Patient2
        public string FirstName { get; set; }
        public string LastName { get; set; }

    public class ViewModel
        private List<Patient2> myPatients = new List<Patient2>() { new Patient2() { FirstName = "Peter", LastName = "Hell" } };

        public ViewModel()
            SelectedPatient = Patients.FirstOrDefault();

        public Patient2 SelectedPatient { get; set; }

        public IQueryable<Patient2> Patients => myPatients.Where(x => x.FirstName == "Peter").AsQueryable();

    private SemaforAuthenticationStateProvider mySemaforAuthenticationStateProvider;
    private ViewModel myViewModel;

    protected override void OnInitialized()
        mySemaforAuthenticationStateProvider = (SemaforAuthenticationStateProvider)myAuthenticationStateProvider;
        myViewModel = new ViewModel();

    internal void OnLogin(LoginArgs loginArgs)
        // Just indicate the login is successful for the role Role1.
        mySemaforAuthenticationStateProvider.NotifyAuthenticated(loginArgs.Username, "Role1");

    private void OnRowSelected(Patient2 patient)
        // Even if this callback is empty the infinite loop happens.


For the completeness here is also AuthenticationStateProvider:

public class SemaforAuthenticationStateProvider : AuthenticationStateProvider
public override async Task GetAuthenticationStateAsync()
AuthenticationState authenticationState = new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity()));
return await Task.FromResult(authenticationState);

public void NotifyAuthenticated(string userName, string userRole)
	ClaimsIdentity identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, userName), new Claim(ClaimTypes.Role, userRole) }, "a");
	ClaimsPrincipal user = new ClaimsPrincipal(identity);
	AuthenticationState authenticationState = new AuthenticationState(user);



I would like to ask for an advise how to overcome this problem.

Honestly I'm not sure why this might happen. Please try to debug your code to see what is creating the loop.

There is not too much for debugging in my code. Please see the code I provided above - it is a fully functional code using only Radzen components which easily reproduces the problem.

I would also attach the visual studio project file with the code above (which could be easily compiled and executed) but as a new user of this group I am getting a message I am not allowed to do uploads :frowning_face:

The infinite loop involves two methods: OnRowSelected and the data query ViewModel.Patients.
(Again strange is the infinite loop occurs even if that OnRowSelected callback is empty. If that callback is not specified the infinite loop does not occur. And also this occurs only if one of tabs is enclosed by AuthorizeView.)

Would it be possible for you to investigate that issue and provide a solution/advise?
(May I send/upload that very simple visual studio project file?)

Are looking for dedicated support? More info about the options can be found here:

Thank you for providing the link to pricing.

I am currently evaluating radzen components if we use them in our projects - and if we purchase the license.

But the problem I found seems like a bug in Radzen and not like a support how to use Radzen components. So maybe it would be also in your interest to figure it out :wink:.

I did a deep investigation on my site to find circumstances and to extract the minimal code to reproduce the problem. The result is I have a visual studio project containing a simple code consisting only from radzen components which can be easily executed - so if you are interested you can conveniently find if there is a bug in your code and improve your product if needed. (Especially if a similar problem was already reported and your answer was you are not able to reproduce it :wink: .(Grid RowSelect event stuck in a loop)).

Hi @ondrej,

Debugging applications is part of the dedicated support that we offer with the Radzen Professional subscription. The other option is to provide a complete single page snippet which we can run. The code you have provided so far depends on other custom code which may or may not be related to the issue.

Hi @korchev,

the code I have provided is the single page snippet (all the code is in that provided single page razor file). The only difference is that AuthenticationStateProvider which contains just two simple methods and which is not possible to put into that razor file because it needs to be registered in the Startup. (That is the reason I have created that visual studio project.)

But I have a feeling I am maybe a bit pushy now. So it is ok not to investigate it further :slight_smile: .

We will conduct an investigation of our own based on the provided information so far.

1 Like