Created
July 2, 2009 23:27
-
-
Save shri-zz/139778 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Merlin/Main/Languages/Ruby/Ruby/Builtins/MutableString.cs b/Merlin/Main/Languages/Ruby/Ruby/Builtins/MutableString.cs | |
index 56ee03b..131c1f7 100644 | |
--- a/Merlin/Main/Languages/Ruby/Ruby/Builtins/MutableString.cs | |
+++ b/Merlin/Main/Languages/Ruby/Ruby/Builtins/MutableString.cs | |
@@ -469,7 +469,11 @@ namespace IronRuby.Builtins { | |
/// The internal representation of the MutableString is preserved. | |
/// </summary> | |
public byte[]/*!*/ ToByteArray() { | |
- return _content.ToByteArray(); | |
+ try { | |
+ return _content.ToByteArray(); | |
+ } catch (System.Text.EncoderFallbackException) { | |
+ return new MutableString.StringContent("EncoderFallbackException in ToByteArray", this).ToByteArray(); | |
+ } | |
} | |
public GenericRegex/*!*/ ToRegularExpression(RubyRegexOptions options) { | |
@@ -493,7 +497,12 @@ namespace IronRuby.Builtins { | |
} | |
public MutableString/*!*/ SwitchToBinary() { | |
- _content.SwitchToBinaryContent(); | |
+ try { | |
+ _content.SwitchToBinaryContent(); | |
+ } catch (System.Text.EncoderFallbackException) { | |
+ SetContent(new MutableString.StringContent("EncoderFallbackException from SwitchToBinary", this)); | |
+ _content.SwitchToBinaryContent(); | |
+ } | |
return this; | |
} | |
diff --git a/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs b/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs | |
index 4de65a6..1a46204 100644 | |
--- a/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs | |
+++ b/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExceptionData.cs | |
@@ -402,8 +402,9 @@ namespace IronRuby.Runtime { | |
RubyExceptionData data = RubyExceptionData.GetInstance(visibleException); | |
if (data._exception != visibleException && data._throwingThread == Thread.CurrentThread) { | |
- Debug.Assert((Thread.CurrentThread.ThreadState & System.Threading.ThreadState.AbortRequested) != 0); | |
- Thread.ResetAbort(); | |
+ if ((Thread.CurrentThread.ThreadState & System.Threading.ThreadState.AbortRequested) != 0) { | |
+ Thread.ResetAbort(); | |
+ } | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment