dotnet / dotnet/docs

Support for calling .NET from a fiber

Open
#27,634 1 comment 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

I looked for _fibers_ and got only one result stating that [fibers are not supported in .NET.](https://github.com/dotnet/docs/blob/6c268f75fbd5e9de9a220de13e9ddc7fb2b568ed/docs/standard/threading/managed-and-unmanaged-threading-in-windows.md).

However, there seems to exist some kind of support for [calling .NET from a fiber](https://github.com/dotnet/runtime/issues/11373) (typically through COM).
It would be good to know the limitations. I've faced the problem of doing this (from a VM that uses green threads in a similar fashion to fibers) and getting a crash. In my case, I see the CLR issuing a loop that accesses stack pages backwards in the stack to detect where is the guard page, but it seems that the guard bits of the stack page are not restored and by calling the CLR a few times eventually it crashes.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 2e267fd4-6615-49ca-c77f-c97ecdbacb9b
* Version Independent ID: 95febe7e-6407-4be4-484d-1621db41c5e7
* Content: [Managed and Unmanaged Threading in Windows](https://docs.microsoft.com/en-us/dotnet/standard/threading/managed-and-unmanaged-threading-in-windows)
* Content Source: [docs/standard/threading/managed-and-unmanaged-threading-in-windows.md](https://github.com/dotnet/docs/blob/main/docs/standard/threading/managed-and-unmanaged-threading-in-windows.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @BillWagner
* Microsoft Alias: **wiwagn**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.