© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
4 replies
SCP999

❔ Blazor - Event executed more than once

It’s the first time I’m asking something on the net, so sorry if the formatting or the way the answer is posed is wrong.

I’m having a problem with an event inside a function. Here’s the code

[JSInvokableAttribute("inserisci")]
    public async Task inserisci(float[] points)
    {   
        await OnInserisci.InvokeAsync(points);
    }
[JSInvokableAttribute("inserisci")]
    public async Task inserisci(float[] points)
    {   
        await OnInserisci.InvokeAsync(points);
    }


This function starts after I pressed a point in a map, but what’s strange is that, after the first time I press, this function executes 2^n times (where n is the number of times I pressed on the map) adding more and more of the same element.

To be specific, the debugger shows me that after the execution reaches the closing parenthesis it starts again from the starts even though there are no loops, recursions or calling from the JS script.

Do you know why this happens? I’m not finding anything about it on the net.

Thanks in advance for the help! (If you need the rest of the code let me know)
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

if statements with more than once condition
C#CC# / help
2y ago
❔ XAML - The property 'Content' is set more than once
C#CC# / help
3y ago
❔ IComponentConnector.Connect is explictly implemented more than once error
C#CC# / help
4y ago
Blazor - No event handlers associated
C#CC# / help
2y ago