You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 20, 2023. It is now read-only.
Create a new worker service - dotnet new worker
Install Singularity.Microsoft.DependencyInjection (v0.17.1)
Worker.cs -
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
namespace test
{
public class Worker : BackgroundService
{
public Worker(IServiceProvider Provider)
{
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
throw new Exception("a");
}
}
}
Program.cs -
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Singularity;
namespace test
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new SingularityServiceProviderFactory(SingularitySettings.Microsoft))
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Worker>();
});
}
}
Workaround - don't throw exceptions in ExecuteAsync
The text was updated successfully, but these errors were encountered:
To reproduce:
Create a new worker service -
dotnet new worker
Install
Singularity.Microsoft.DependencyInjection
(v0.17.1)Worker.cs -
Program.cs -
Workaround - don't throw exceptions in
ExecuteAsync
The text was updated successfully, but these errors were encountered: