I gather that you are using this code example: Blazor: Timer Example - Refresh Data - PROWARE technologies
Your lambda method is calling a remote endpoint. When offline, it will fail. So the Timer is working, just the data is not refreshed. You can check this by setting a breakpoint on the line:
forecasts = await Http.GetFromJsonAsync<WeatherForecast>("WeatherForecast");
The timer will execute the lambda method every two seconds.
You can check it by using this code:
<h1>Tick Count: @tickCount</h1>
private int tickCount = 0;
private Timer? timer;
protected override Task OnInitializedAsync()
timer = new Timer(stateInfo =>
tickCount += 1;
}, new AutoResetEvent(false), 2000, 2000);
When run, the Tick Count will update every 2 seconds.