Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some mechanism for catching structured exceptions on Windows #38963

Open
Tracked by #3
jrmuizel opened this issue Jan 10, 2017 · 2 comments
Open
Tracked by #3

Add some mechanism for catching structured exceptions on Windows #38963

jrmuizel opened this issue Jan 10, 2017 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-windows Operating system: Windows

Comments

@jrmuizel
Copy link
Contributor

There are a number of places where we are forced to catch these exceptions in Gecko (see MOZ_SEH_TRY). The usual reason is for handling some bug in code that we have no control over.

Structured exceptions are also used for naming threads on Windows so it would be nice to have that too.

@Trolldemorted
Copy link
Contributor

Do you have any idea when this will be supported? Not being able to catch structured exceptions makes it impossible to use file views which throw an exception when an IO error occurs (including network errors when the file is on a network share).

What happens if an exception is thrown right now? I assume my process will just die?

Are there well-known hacks to work around this (inline assembly, abusing panic::catch_unwind, anything) available?

@mzji
Copy link

mzji commented Dec 26, 2020

Do you have any idea when this will be supported? Not being able to catch structured exceptions makes it impossible to use file views which throw an exception when an IO error occurs (including network errors when the file is on a network share).

What happens if an exception is thrown right now? I assume my process will just die?

Are there well-known hacks to work around this (inline assembly, abusing panic::catch_unwind, anything) available?

AFAIK, the only practical workaround (now) is writing a C function which has the required __try/__catch block to handle the exception and returns the result in a Rust-compatible structure (or something like that), and compiling it with MSVC and linking to it in your crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

5 participants