There is a 3rd-party code from the library which "hangs" waiting for somewhere in the work with the network. CancellationToken no support, no timeout. I run it through:
Task.Run(() => FooWith3rdPart()); The first idea was to make hara-kiri:
void FooWith3rdPart() { new Timer(Thread.CurrentThread.Abort, null, 1000, -1); // here stuck code } But in netcore there is no CurrentThread.Abort .
What other options are there?