Skip to content

Commit b1806f5

Browse files
authored
Merge pull request #29 from punchready/master
Fix MonoMod/MonoMod#93
2 parents d679ae7 + fbada52 commit b1806f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

RuntimeDetour/Platforms/Runtime/DetourRuntimeNETCore30Platform.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ protected unsafe CorJitResult CompileMethodHook(
179179
out byte* nativeEntry,
180180
out uint nativeSizeOfCode) {
181181

182+
int _lastError = Marshal.GetLastPInvokeError();
183+
182184
nativeEntry = null;
183185
nativeSizeOfCode = 0;
184186

@@ -223,6 +225,8 @@ protected unsafe CorJitResult CompileMethodHook(
223225
}
224226
}
225227

228+
Marshal.SetLastPInvokeError(_lastError);
229+
226230
return result;
227231
} finally {
228232
hookEntrancy--;

0 commit comments

Comments
 (0)