Hi @Luc Gosso
we have this error ONLY three times every hour in the logs, on a site with thousands of visitors every day.
It may be tied to specific conditions like network latency, bot traffic, or other intermittent factors. You can implement additional logging or monitoring to capture the specific circumstances when this error occurs, such as IP address, user-agent string, and timing information. This will help you identify patterns that could explain the error.
try
{
// Log user-agent and other context information.
var userAgent = HttpContext.Request.Headers["User-Agent"].ToString();
Logger.LogInformation($"User-Agent: {userAgent}");
await JsRuntime.InvokeVoidAsync("preventBlazorScroll");
}
catch (Exception ex)
{
Logger.LogWarning(ex, "JavaScript couldn't run");
}
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Rena