Skip to content

Commit abb26bc

Browse files
authored
Remove debugreturn.h and machinery around preventing returns (#116563)
1 parent f76e203 commit abb26bc

File tree

123 files changed

+729
-944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+729
-944
lines changed

docs/design/coreclr/botr/exceptions.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ The basic macros are, of course, EX_TRY / EX_CATCH / EX_END_CATCH, and in use th
3131
EX_CATCH
3232
// If we're here, something failed.
3333
m_finalDisposition = terminallyHopeless;
34-
EX_END_CATCH(RethrowTransientExceptions)
34+
RethrowTransientExceptions();
35+
EX_END_CATCH
3536

3637
The EX_TRY macro simply introduces the try block, and is much like the C++ "try", except that it also includes an opening brace, "{".
3738

@@ -70,7 +71,8 @@ More information is often most conveniently available through the managed except
7071
// . . . do something that might throw
7172
EX_CATCH
7273
throwable = GET_THROWABLE();
73-
EX_END_CATCH(RethrowTransientExceptions)
74+
RethrowTransientExceptions();
75+
EX_END_CATCH
7476
// . . . do something with throwable
7577
GCPROTECT_END()
7678

@@ -81,12 +83,11 @@ Sometimes, there is no avoiding a need for the C++ exception object, though this
8183

8284
would tell whether the exception is (or derives from) CLRException.
8385

84-
EX_END_CATCH(RethrowTransientExceptions)
86+
RethrowTransientExceptions
8587
----------------------------------------
8688

87-
In the example above, "RethrowTransientExceptions" is an argument to the EX_END_CATCH macro; it is one of three pre-defined macros that can be thought of "exception disposition". Here are the macros, and their meanings:
89+
In the example above, "RethrowTransientExceptions" is a macro in the `EX_CATCH` block; it is one of three pre-defined macros that can be thought of "exception disposition". Here are the macros, and their meanings:
8890

89-
- _SwallowAllExceptions_: This is aptly named, and very simple. As the name suggests, it swallows everything. While simple and appealing, this is often not the right thing to do.
9091
- _RethrowTerminalExceptions_. A better name would be "RethrowThreadAbort", which is what this macro does.
9192
- _RethrowTransientExceptions_. The best definition of a "transient" exception is one that might not occur if tried again, possibly in a different context. These are the transient exceptions:
9293
- COR_E_THREADABORTED
@@ -102,9 +103,7 @@ In the example above, "RethrowTransientExceptions" is an argument to the EX_END_
102103

103104
The CLR developer with doubts about which macro to use should probably pick _RethrowTransientExceptions_.
104105

105-
In every case, however, the developer writing an EX_END_CATCH needs to think hard about which exception should be caught, and should catch only those exceptions. And, because the macros catch everything anyway, the only way to not catch an exception is to rethrow it.
106-
107-
If an EX_CATCH / EX_END_CATCH block has properly categorized its exceptions, and has rethrown wherever necessary, then SwallowAllExceptions is the way to tell the macros that no further rethrowing is necessary.
106+
In every case, however, the developer writing an EX_CATCH block needs to think hard about which exception should be caught, and should catch only those exceptions. And, because the macros catch everything anyway, the only way to not catch an exception is to rethrow it.
108107

109108
## EX_CATCH_HRESULT
110109

src/coreclr/binder/assemblybindercommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ HRESULT AssemblyBinderCommon::BindUsingPEImage(/* in */ AssemblyBinder* pBinder
12321232
hr = GET_EXCEPTION()->GetHR();
12331233
goto Exit;
12341234
}
1235-
EX_END_CATCH(SwallowAllExceptions);
1235+
EX_END_CATCH
12361236

12371237

12381238
mvidMismatch = incomingMVID != boundMVID;

0 commit comments

Comments
 (0)