From 702577b2dfb656689e0fd527706f02e6f72b68ae Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 22:46:22 +0200 Subject: [PATCH 01/13] CI: the GitHub actions on their Node 24 majors Every job warned that checkout, cache, setup-dotnet and upload-artifact target Node.js 20 and are being forced onto Node.js 24. checkout@v7, cache@v6, setup-dotnet@v6, upload-artifact@v7 and download-artifact@v8 run on Node 24 themselves. Nothing in their breaking changes touches how the workflows use them: plain checkouts on pull_request and push, .NET 8 and 10, zipped uploads, and one merge-multiple download by name. --- .github/workflows/ci.yml | 30 +++++++++++++++--------------- .github/workflows/release.yml | 12 ++++++------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32523972..ffe1e268 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,20 +57,20 @@ jobs: run: git config --global core.autocrlf input - name: Check out IronRuby - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: ironruby # The modern DLR is referenced as source projects from a sibling directory, # and prism supplies the parser itself. - name: Check out the DLR - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: IronLanguages/dlr path: dlr - name: Check out prism - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: repository: ruby/prism path: prism @@ -86,7 +86,7 @@ jobs: # Both runtimes are installed on every matrix entry: the SDK builds either # target framework, but running the net8.0 output needs the .NET 8 runtime. - - uses: actions/setup-dotnet@v4 + - uses: actions/setup-dotnet@v6 with: dotnet-version: | 8.0.x @@ -97,7 +97,7 @@ jobs: ruby-version: '3.3' - name: Cache NuGet packages - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: ~/.nuget/packages key: nuget-${{ matrix.os }}-${{ hashFiles('ironruby/**/*.csproj', 'ironruby/Directory.Build.props', 'dlr/**/*.csproj') }} @@ -109,7 +109,7 @@ jobs: - name: Cache the prism build id: prism-cache - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: prism/build key: prism-${{ matrix.os }}-${{ steps.prism.outputs.sha }} @@ -310,7 +310,7 @@ jobs: # The full transcript, for looking at a failure that is inside the baseline. - name: Keep the test output if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ironruby-tests-${{ matrix.os }}-${{ matrix.tfm }} path: ironruby/Src/IronRuby.Tests/bin/Debug/${{ matrix.tfm }}/results.txt @@ -327,22 +327,22 @@ jobs: TFM: ${{ matrix.tfm }} IR_TFM: ${{ matrix.tfm }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: path: ironruby - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: repository: IronLanguages/dlr path: dlr - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: repository: ruby/prism path: prism - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: repository: ruby/spec path: ironruby/spec - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: repository: ruby/mspec path: ironruby/mspec @@ -355,7 +355,7 @@ jobs: git -C dlr apply "../$patch" done - - uses: actions/setup-dotnet@v4 + - uses: actions/setup-dotnet@v6 with: dotnet-version: | 8.0.x @@ -365,7 +365,7 @@ jobs: ruby-version: '3.3' - name: Cache NuGet packages - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: ~/.nuget/packages key: nuget-ubuntu-latest-${{ hashFiles('ironruby/**/*.csproj', 'ironruby/Directory.Build.props', 'dlr/**/*.csproj') }} @@ -377,7 +377,7 @@ jobs: - name: Cache the prism build id: prism-cache - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: prism/build key: prism-ubuntu-latest-${{ steps.prism.outputs.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b312ae7..80769fca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,16 +48,16 @@ jobs: if: runner.os == 'Windows' run: git config --global core.autocrlf input - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: path: ironruby - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: repository: IronLanguages/dlr path: dlr - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: repository: ruby/prism ref: ${{ env.PRISM_REF }} @@ -72,7 +72,7 @@ jobs: # The DLR multi-targets up to net9.0, so the build needs the .NET 10 SDK; the # release itself targets net8.0. - - uses: actions/setup-dotnet@v4 + - uses: actions/setup-dotnet@v6 with: dotnet-version: | 8.0.x @@ -118,7 +118,7 @@ jobs: fi Util/package-release.sh "${{ matrix.rid }}" "$GITHUB_WORKSPACE/dist" - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: ironruby-${{ matrix.rid }} path: | @@ -134,7 +134,7 @@ jobs: permissions: contents: write steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: path: dist merge-multiple: true From 9d71e4293b59b6b2ead621d63f287387d00d47f1 Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 22:47:07 +0200 Subject: [PATCH 02/13] Tests and libraries: Type's own properties instead of the obsolete DLR helpers ReflectionUtils.IsInterface(t) and IsGenericTypeDefinition(t) are obsolete in the DLR (CS0618) and only return t.IsInterface / t.IsGenericTypeDefinition, and StringUtils.DefaultEncoding is Encoding.Default. --- Src/IronRuby.Tests/Helpers.cs | 4 ++-- Src/Libraries/Builtins/ModuleOps.cs | 4 ++-- Src/Libraries/Extensions/TypeGroupOps.cs | 4 ++-- Src/Libraries/Extensions/TypeOps.cs | 2 +- Src/Libraries/Extensions/TypeTrackerOps.cs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Src/IronRuby.Tests/Helpers.cs b/Src/IronRuby.Tests/Helpers.cs index b525a144..0b32601d 100644 --- a/Src/IronRuby.Tests/Helpers.cs +++ b/Src/IronRuby.Tests/Helpers.cs @@ -290,13 +290,13 @@ private void RedirectOutput(TextWriter/*!*/ output, Action f) { f(); } else { MemoryStream stream = new MemoryStream(); - Runtime.IO.SetOutput(stream, StringUtils.DefaultEncoding); + Runtime.IO.SetOutput(stream, Encoding.Default); Runtime.IO.SetErrorOutput(Console.OpenStandardError(), Console.Error); try { f(); } finally { - output.Write(StringUtils.DefaultEncoding.GetString(stream.ToArray())); + output.Write(Encoding.Default.GetString(stream.ToArray())); Runtime.IO.RedirectToConsole(); } } diff --git a/Src/Libraries/Builtins/ModuleOps.cs b/Src/Libraries/Builtins/ModuleOps.cs index 04337112..0b69137a 100644 --- a/Src/Libraries/Builtins/ModuleOps.cs +++ b/Src/Libraries/Builtins/ModuleOps.cs @@ -1834,7 +1834,7 @@ public static RubyModule ToClrRef(RubyModule/*!*/ self) { return self.Context.GetModule(arrayType); } - if (!type.IsGenericTypeDefinition()) { + if (!type.IsGenericTypeDefinition) { if (provided > 0) { throw RubyExceptions.CreateArgumentError("`{0}' is not a generic type definition", self.Name); } @@ -1859,7 +1859,7 @@ public static RubyModule ToClrRef(RubyModule/*!*/ self) { Type type = self.TypeTracker.Type; - if (!type.IsGenericTypeDefinition()) { + if (!type.IsGenericTypeDefinition) { if (genericArity > 0) { throw RubyExceptions.CreateArgumentError("`{0}' is not a generic type definition", self.Name); } diff --git a/Src/Libraries/Extensions/TypeGroupOps.cs b/Src/Libraries/Extensions/TypeGroupOps.cs index 30fbdbc6..54b1972a 100644 --- a/Src/Libraries/Extensions/TypeGroupOps.cs +++ b/Src/Libraries/Extensions/TypeGroupOps.cs @@ -124,7 +124,7 @@ public static object EachType(RubyContext/*!*/ context, BlockParam/*!*/ block, T [Emitted] public static RubyClass/*!*/ GetNonGenericClass(RubyContext/*!*/ context, TypeGroup/*!*/ typeGroup) { Type type = GetNonGenericType(typeGroup); - if (type.IsInterface()) { + if (type.IsInterface) { throw RubyExceptions.CreateTypeError("cannot instantiate an interface"); } return context.GetClass(type); @@ -169,7 +169,7 @@ public static object New(CallSiteStorage Date: Wed, 30 Sep 2026 22:47:37 +0200 Subject: [PATCH 03/13] Builtins, compiler and hosting: Type properties and string.Split The obsolete DLR helpers (CS0618) ReflectionUtils.IsValueType, IsVisible, IsSealed, IsPublic, IsGenericType, IsInterface and ContainsGenericParameters answer the Type property of the same name, and StringUtils.Split(s, ...) is s.Split(...), so the callers use those directly. --- Src/Ruby/Builtins/MutableString.cs | 2 +- Src/Ruby/Builtins/RubyClass.cs | 8 ++++---- Src/Ruby/Compiler/Ast/AstFactory.cs | 2 +- Src/Ruby/Compiler/AstGenerator.cs | 2 +- Src/Ruby/Compiler/Generation/ClsTypeEmitter.cs | 2 +- Src/Ruby/Compiler/Generation/InterfaceImplFeature.cs | 2 +- Src/Ruby/Compiler/Generation/RubyTypeDispenser.cs | 2 +- Src/Ruby/Compiler/Parser/GPPG.cs | 2 +- Src/Ruby/Hosting/RubyOptionsParser.cs | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Src/Ruby/Builtins/MutableString.cs b/Src/Ruby/Builtins/MutableString.cs index 8a0342f0..432c3467 100644 --- a/Src/Ruby/Builtins/MutableString.cs +++ b/Src/Ruby/Builtins/MutableString.cs @@ -1862,7 +1862,7 @@ public int GetFirstChar() { public MutableString[]/*!*/ Split(char[]/*!*/ separators, int maxComponents, StringSplitOptions options) { // TODO: // TODO (encoding): - return MakeArray(StringUtils.Split(_content.ConvertToString(), separators, maxComponents, options), _encoding); + return MakeArray(_content.ConvertToString().Split(separators, maxComponents, options), _encoding); } #endregion diff --git a/Src/Ruby/Builtins/RubyClass.cs b/Src/Ruby/Builtins/RubyClass.cs index 228284c0..c5037b04 100644 --- a/Src/Ruby/Builtins/RubyClass.cs +++ b/Src/Ruby/Builtins/RubyClass.cs @@ -1276,7 +1276,7 @@ private bool IsVisible(MethodAttributes/*!*/ attributes, Type declaringType, boo case MethodAttributes.Family: case MethodAttributes.FamORAssem: - return declaringType != null && declaringType.IsVisible() && !declaringType.IsSealed(); + return declaringType != null && declaringType.IsVisible && !declaringType.IsSealed; } return true; @@ -1292,7 +1292,7 @@ private bool IsVisible(FieldInfo/*!*/ field) { } if (field.IsProtected()) { - return field.DeclaringType != null && field.DeclaringType.IsVisible() && !field.DeclaringType.IsSealed(); + return field.DeclaringType != null && field.DeclaringType.IsVisible && !field.DeclaringType.IsSealed; } return true; @@ -1542,7 +1542,7 @@ public void BuildObjectConstructionNoFlow(MetaObjectBuilder/*!*/ metaBuilder, Ca // TODO: handle protected constructors constructionOverloads = GetConstructors(type == typeof(object) ? typeof(RubyObject) : type).ToArray(); - if (type.IsValueType()) { + if (type.IsValueType) { if (constructionOverloads.Length == 0 || GetConstructor(type) == null) { constructionOverloads = ArrayUtils.Append(constructionOverloads, new ReflectionOverloadInfo(Methods.CreateDefaultInstance)); } @@ -1669,7 +1669,7 @@ private Expression GetAllocatorNewExpression(CallArguments/*!*/ args, Func)); + Debug.Assert(reference.LocalType.IsGenericType && reference.LocalType.GetGenericTypeDefinition() == typeof(StrongBox<>)); Debug.Assert(parameter.ParameterType.IsByRef); _parameter = parameter; diff --git a/Src/Ruby/Compiler/Generation/InterfaceImplFeature.cs b/Src/Ruby/Compiler/Generation/InterfaceImplFeature.cs index 592ac5f7..e3189969 100644 --- a/Src/Ruby/Compiler/Generation/InterfaceImplFeature.cs +++ b/Src/Ruby/Compiler/Generation/InterfaceImplFeature.cs @@ -49,7 +49,7 @@ internal InterfaceImplFeature(IList/*!*/ interfaceTypes) { private static void AddInterface(List/*!*/ types, Type/*!*/ type) { Assert.NotNull(type); - Assert.Equals(true, type.IsInterface() && !type.ContainsGenericParameters()); + Assert.Equals(true, type.IsInterface && !type.ContainsGenericParameters); for (int i = 0; i < types.Count; i++) { Type t = types[i]; diff --git a/Src/Ruby/Compiler/Generation/RubyTypeDispenser.cs b/Src/Ruby/Compiler/Generation/RubyTypeDispenser.cs index 369ac2fc..f6a56ca2 100644 --- a/Src/Ruby/Compiler/Generation/RubyTypeDispenser.cs +++ b/Src/Ruby/Compiler/Generation/RubyTypeDispenser.cs @@ -101,7 +101,7 @@ private static bool TypeImplementsFeatures(Type/*!*/ type, IList Date: Wed, 30 Sep 2026 22:49:22 +0200 Subject: [PATCH 04/13] Runtime: Type properties, and no IsCompactFramework The obsolete DLR helpers (CS0618) ReflectionUtils.IsValueType, IsEnum, IsGenericType, IsSealed, IsVisible, IsInterface and GetBaseType answer the Type property of the same name, so the callers use it. PlatformAdaptationLayer.IsCompactFramework is a constant false and obsolete: the weak table always asks for a long weak reference, a stack frame always gives its line number, and the asserts that the 128-field tuple is not built on the Compact Framework go. --- Src/Ruby/Runtime/Calls/MetaObjectBuilder.cs | 4 ++-- Src/Ruby/Runtime/Calls/RubyMethodGroupBase.cs | 2 +- Src/Ruby/Runtime/Calls/RubyOverloadResolver.cs | 12 ++++++------ Src/Ruby/Runtime/Conversions/Converter.cs | 8 ++++---- .../Runtime/Conversions/GenericConversionAction.cs | 4 ++-- .../Runtime/Conversions/ProtocolConversionAction.cs | 4 ++-- Src/Ruby/Runtime/InstanceDataWeakTable.cs | 3 +-- Src/Ruby/Runtime/RubyExceptions.cs | 2 +- Src/Ruby/Runtime/RubyOps.cs | 2 -- Src/Ruby/Runtime/RubyStackTraceBuilder.cs | 2 +- 10 files changed, 20 insertions(+), 23 deletions(-) diff --git a/Src/Ruby/Runtime/Calls/MetaObjectBuilder.cs b/Src/Ruby/Runtime/Calls/MetaObjectBuilder.cs index 63f1b69d..21fae0f2 100644 --- a/Src/Ruby/Runtime/Calls/MetaObjectBuilder.cs +++ b/Src/Ruby/Runtime/Calls/MetaObjectBuilder.cs @@ -205,7 +205,7 @@ public void AddObjectTypeRestriction(object value, Expression/*!*/ expression) { public void AddTypeRestriction(Type/*!*/ type, Expression/*!*/ expression) { if (_treatRestrictionsAsConditions) { AddCondition(Ast.TypeEqual(expression, type)); - } else if (expression.Type != type || !type.IsSealed()) { + } else if (expression.Type != type || !type.IsSealed) { Add(BindingRestrictions.GetTypeRestriction(expression, type)); } } @@ -261,7 +261,7 @@ public void AddTargetTypeTest(object target, RubyClass/*!*/ targetClass, Express // Ruby objects (get the method directly to prevent interface dispatch): MethodInfo classGetter = type.GetMethod(Methods.IRubyObject_get_ImmediateClass.Name, BindingFlags.Public | BindingFlags.Instance); - if (type.IsVisible() && classGetter != null && classGetter.ReturnType == typeof(RubyClass)) { + if (type.IsVisible && classGetter != null && classGetter.ReturnType == typeof(RubyClass)) { AddCondition( // (#{type})target.ImmediateClass.Version.Method == #{immediateClass.Version.Method} Ast.Equal( diff --git a/Src/Ruby/Runtime/Calls/RubyMethodGroupBase.cs b/Src/Ruby/Runtime/Calls/RubyMethodGroupBase.cs index 6bbac2c9..15d6308e 100644 --- a/Src/Ruby/Runtime/Calls/RubyMethodGroupBase.cs +++ b/Src/Ruby/Runtime/Calls/RubyMethodGroupBase.cs @@ -335,7 +335,7 @@ internal static void BuildCallNoFlow(MetaObjectBuilder/*!*/ metaBuilder, CallArg if (bindingTarget.Success) { // TODO: create a custom overload info: if (ReferenceEquals(bindingTarget.Overload.ReflectionInfo, Methods.CreateDefaultInstance)) { - Debug.Assert(args.TargetClass.TypeTracker.Type.IsValueType()); + Debug.Assert(args.TargetClass.TypeTracker.Type.IsValueType); metaBuilder.Result = Ast.New(args.TargetClass.TypeTracker.Type); } else if (args.Signature.IsVirtualCall && bindingTarget.Overload.IsVirtual) { // Virtual methods that have been detached from the CLR type and diff --git a/Src/Ruby/Runtime/Calls/RubyOverloadResolver.cs b/Src/Ruby/Runtime/Calls/RubyOverloadResolver.cs index 600908c7..15cf9e6d 100644 --- a/Src/Ruby/Runtime/Calls/RubyOverloadResolver.cs +++ b/Src/Ruby/Runtime/Calls/RubyOverloadResolver.cs @@ -486,7 +486,7 @@ public override Candidate SelectBestConversionFor(DynamicMetaObject/*!*/ arg, Pa if (typeOne == actualType) { if (typeTwo == actualType) { // prefer non-nullable reference type over nullable: - if (!actualType.IsValueType()) { + if (!actualType.IsValueType) { if (candidateOne.ProhibitNull) { return Candidate.One; } else if (candidateTwo.ProhibitNull) { @@ -513,11 +513,11 @@ public override Candidate SelectBestConversionFor(DynamicMetaObject/*!*/ arg, Pa } // prefer integer type over enum: - if (typeOne.IsEnum() && Enum.GetUnderlyingType(typeOne) == typeTwo) { + if (typeOne.IsEnum && Enum.GetUnderlyingType(typeOne) == typeTwo) { return Candidate.Two; } - if (typeTwo.IsEnum() && Enum.GetUnderlyingType(typeTwo) == typeOne) { + if (typeTwo.IsEnum && Enum.GetUnderlyingType(typeTwo) == typeOne) { return Candidate.One; } @@ -552,7 +552,7 @@ public override Candidate SelectBestConversionFor(DynamicMetaObject/*!*/ arg, Pa if (restrictedType != null) { if (restrictedType == typeof(DynamicNull)) { - if (!toType.IsValueType() || toType.IsGenericType() && toType.GetGenericTypeDefinition() == typeof(Nullable<>)) { + if (!toType.IsValueType || toType.IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>)) { return AstUtils.Constant(null, toType); } else if (toType == typeof(bool)) { return AstUtils.Constant(false); @@ -817,7 +817,7 @@ private Expression MakeIncorrectArgumentCountError(BindingTarget target) { /// Array" into something no Ruby programmer would recognise. /// private string/*!*/ GetConversionTargetName(Type/*!*/ type) { - if (type.IsGenericType() && type.GetGenericTypeDefinition() == typeof(Union<,>)) { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Union<,>)) { var g = type.GetGenericArguments(); return GetConversionTargetName(g[0]) + " or " + GetConversionTargetName(g[1]); } @@ -843,7 +843,7 @@ private Expression MakeCallFailureError(BindingTarget target) { return Methods.CreateArgumentsErrorForProc.OpCall(AstUtils.Constant(cr.GetArgumentTypeName(Binder))); } - Debug.Assert(typeof(BlockParam).IsSealed()); + Debug.Assert(typeof(BlockParam).IsSealed); if (cr.To == typeof(BlockParam)) { return Methods.CreateArgumentsErrorForMissingBlock.OpCall(); } diff --git a/Src/Ruby/Runtime/Conversions/Converter.cs b/Src/Ruby/Runtime/Conversions/Converter.cs index c4b68723..36589615 100644 --- a/Src/Ruby/Runtime/Conversions/Converter.cs +++ b/Src/Ruby/Runtime/Conversions/Converter.cs @@ -75,11 +75,11 @@ internal static Convertibility CanConvertFrom(DynamicMetaObject fromArg, Type/*! return Convertibility.NotConvertible; } - if (toType.IsGenericType() && toType.GetGenericTypeDefinition() == typeof(Nullable<>)) { + if (toType.IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>)) { return Convertibility.AlwaysConvertible; } - if (!toType.IsValueType()) { + if (!toType.IsValueType) { // null convertible to any reference type: return Convertibility.AlwaysConvertible; } else if (toType == typeof(bool)) { @@ -176,7 +176,7 @@ internal static Convertibility CanConvertFrom(DynamicMetaObject fromArg, Type/*! } // A COM object can potentially be converted to the given interface, but might also be not so use this only as the last resort: - if (TypeUtils.IsComObjectType(fromType) && toType.IsInterface()) { + if (TypeUtils.IsComObjectType(fromType) && toType.IsInterface) { return Convertibility.AlwaysConvertible; } @@ -244,7 +244,7 @@ internal static Expression ExplicitConvert(Expression/*!*/ expr, Type/*!*/ fromT if (toType == typeof(bool)) { Debug.Assert(fromType != typeof(bool)); - return fromType.IsValueType() ? AstUtils.Constant(true) : Ast.NotEqual(expr, AstUtils.Constant(null)); + return fromType.IsValueType ? AstUtils.Constant(true) : Ast.NotEqual(expr, AstUtils.Constant(null)); } // TODO: diff --git a/Src/Ruby/Runtime/Conversions/GenericConversionAction.cs b/Src/Ruby/Runtime/Conversions/GenericConversionAction.cs index 7bc25d96..dd2fe4dc 100644 --- a/Src/Ruby/Runtime/Conversions/GenericConversionAction.cs +++ b/Src/Ruby/Runtime/Conversions/GenericConversionAction.cs @@ -46,7 +46,7 @@ internal GenericConversionAction(RubyContext context, Type/*!*/ type) Assert.NotNull(type); // Type must be visible so that we can serialize it in MakeShared. - Debug.Assert(type.IsVisible()); + Debug.Assert(type.IsVisible); _type = type; } @@ -104,7 +104,7 @@ internal static bool BuildConversion(MetaObjectBuilder/*!*/ metaBuilder, Dynamic private static Expression TryImplicitConversion(DynamicMetaObject/*!*/ target, Type/*!*/ toType) { // TODO: include this into ImplicitConvert? if (target.Value == null) { - if (!toType.IsValueType() || toType.IsGenericType() && toType.GetGenericTypeDefinition() == typeof(Nullable<>)) { + if (!toType.IsValueType || toType.IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>)) { return AstUtils.Constant(null, toType); } else { return null; diff --git a/Src/Ruby/Runtime/Conversions/ProtocolConversionAction.cs b/Src/Ruby/Runtime/Conversions/ProtocolConversionAction.cs index 9bcc81af..31e7fc27 100644 --- a/Src/Ruby/Runtime/Conversions/ProtocolConversionAction.cs +++ b/Src/Ruby/Runtime/Conversions/ProtocolConversionAction.cs @@ -87,7 +87,7 @@ private static Func TryGetDefaultCo // nullable int (see Array#fill, Sockets:ConvertToSocketFlag, Kernel#open(perm=nil), File.chown, IO#read) // TODO: do we want to use a default protocol for enums? - if (parameterType.IsEnum()) { + if (parameterType.IsEnum) { return null; } @@ -423,7 +423,7 @@ protected virtual void SetError(MetaObjectBuilder/*!*/ metaBuilder, CallArgument } private static Expression/*!*/ ConvertResult(Expression/*!*/ expression, Type/*!*/ resultType) { - if (resultType.IsGenericType() && resultType.GetGenericTypeDefinition() == typeof(Union<,>)) { + if (resultType.IsGenericType && resultType.GetGenericTypeDefinition() == typeof(Union<,>)) { var args = resultType.GetGenericArguments(); var ctor = resultType.GetConstructor(args); if (args[0].IsAssignableFrom(expression.Type)) { diff --git a/Src/Ruby/Runtime/InstanceDataWeakTable.cs b/Src/Ruby/Runtime/InstanceDataWeakTable.cs index 842de125..329b3bda 100644 --- a/Src/Ruby/Runtime/InstanceDataWeakTable.cs +++ b/Src/Ruby/Runtime/InstanceDataWeakTable.cs @@ -150,8 +150,7 @@ public void Add(TKey key, TValue value) { // _dict might be a new Dictionary after Cleanup(), // so use the field directly - // CF throws doesn't support long weak references (NotSuportedException is thrown) - _dict.Add(new WeakReference(key, !PlatformAdaptationLayer.IsCompactFramework), value); + _dict.Add(new WeakReference(key, trackResurrection: true), value); } } diff --git a/Src/Ruby/Runtime/RubyExceptions.cs b/Src/Ruby/Runtime/RubyExceptions.cs index 3b42ce8b..364429ad 100644 --- a/Src/Ruby/Runtime/RubyExceptions.cs +++ b/Src/Ruby/Runtime/RubyExceptions.cs @@ -220,7 +220,7 @@ private static void AppendQuoted(StringBuilder/*!*/ result, MutableString/*!*/ s public static Exception/*!*/ CreateMissingDefaultConstructorError(RubyClass/*!*/ rubyClass, string/*!*/ initializerOwnerName) { Debug.Assert(rubyClass.IsRubyClass); - Type baseType = rubyClass.GetUnderlyingSystemType().GetBaseType(); + Type baseType = rubyClass.GetUnderlyingSystemType().BaseType; Debug.Assert(baseType != null); return CreateTypeError("can't allocate class `{1}' that derives from type `{0}' with no default constructor;" + diff --git a/Src/Ruby/Runtime/RubyOps.cs b/Src/Ruby/Runtime/RubyOps.cs index 1aef9f9c..33e68e2d 100644 --- a/Src/Ruby/Runtime/RubyOps.cs +++ b/Src/Ruby/Runtime/RubyOps.cs @@ -3923,7 +3923,6 @@ public static void SerializeObject(RubyInstanceData instanceData, RubyClass/*!*/ } else if (fieldCount <= 64) { return typeof(MutableTuple); } else { - Debug.Assert(!PlatformAdaptationLayer.IsCompactFramework); return MakeObjectTupleType128(); } } @@ -3957,7 +3956,6 @@ public static void SerializeObject(RubyInstanceData instanceData, RubyClass/*!*/ } else if (fieldCount <= 64) { return new MutableTuple(); } else { - Debug.Assert(!PlatformAdaptationLayer.IsCompactFramework); return CreateObjectTuple128(); } } diff --git a/Src/Ruby/Runtime/RubyStackTraceBuilder.cs b/Src/Ruby/Runtime/RubyStackTraceBuilder.cs index 9348fb0a..fb67f6d4 100644 --- a/Src/Ruby/Runtime/RubyStackTraceBuilder.cs +++ b/Src/Ruby/Runtime/RubyStackTraceBuilder.cs @@ -332,7 +332,7 @@ private bool TryGetStackFrameInfo(StackFrame/*!*/ frame, out string/*!*/ methodN methodName = method.Name; fileName = (_hasFileAccessPermission) ? GetFileName(frame) : null; - var sourceLine = line = PlatformAdaptationLayer.IsCompactFramework ? 0 : frame.GetFileLineNumber(); + var sourceLine = line = frame.GetFileLineNumber(); if (TryParseRubyMethodName(ref methodName, ref fileName, ref line)) { if (sourceLine == 0) { From bcaf77cbe21eb676e050e5db1d4ed79c4e502431 Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 22:49:24 +0200 Subject: [PATCH 05/13] Loader: loaded scripts in a ConcurrentDictionary The DLR's SynchronizedDictionary is obsolete (CS0618) and points to ConcurrentDictionary. It locked the inner Dictionary around every call, and nothing locked it from outside or reached the underlying dictionary, so the swap keeps LoadedScripts' IDictionary contract and its path comparer. Enumerating IronRuby.loaded_scripts no longer follows insertion order, and it no longer throws when another thread loads a script meanwhile. --- Src/Ruby/Runtime/Loader.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Src/Ruby/Runtime/Loader.cs b/Src/Ruby/Runtime/Loader.cs index 8a4a1451..491ccac3 100644 --- a/Src/Ruby/Runtime/Loader.cs +++ b/Src/Ruby/Runtime/Loader.cs @@ -16,6 +16,7 @@ using System; using System.Linq; using System.Collections; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -80,7 +81,7 @@ internal enum FileKind { private readonly Dictionary/*!*/ _unfinishedFiles; // lazy init - private SynchronizedDictionary _loadedScripts; + private ConcurrentDictionary _loadedScripts; #if FEATURE_FILESYSTEM // TODO: static @@ -127,7 +128,7 @@ public IDictionary/*!*/ LoadedScripts { get { if (_loadedScripts == null) { Interlocked.CompareExchange(ref _loadedScripts, - new SynchronizedDictionary(new Dictionary(DomainManager.Platform.PathComparer)), null + new ConcurrentDictionary(DomainManager.Platform.PathComparer), null ); } return _loadedScripts; From ed9715765a94648ff1559633698f45ecbc6d07bb Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 22:51:04 +0200 Subject: [PATCH 06/13] Drop the Thread.Abort and AppDomain code .NET 8 and 10 cannot run Thread.Abort and Thread.ResetAbort throw PlatformNotSupportedException on .NET Core (SYSLIB0006), and so does AppDomain.CreateDomain (SYSLIB0024). - Interpreter3 returned before doing anything unless it ran on .NET Framework or Mono, and Interpreter4's body was commented out; they go with the abort helpers only they used. - Helpers.CreateDomain had no callers. - RubyExceptionData.ActiveExceptionHandled reset a pending abort when Thread#raise had delivered the exception with Thread.Abort. Thread#raise has been cooperative since the .NET Core port (RubyUtils.RaiseAsyncException), so an exception never differs from its visible one there and the branch could not run; the method is the no-op it already was without FEATURE_EXCEPTION_STATE. --- Src/IronRuby.Tests/Helpers.cs | 6 - Src/IronRuby.Tests/RubyTests.cs | 2 - .../Runtime/InterpreterTests.cs | 179 ------------------ Src/Ruby/Runtime/RubyExceptionData.cs | 24 +-- 4 files changed, 4 insertions(+), 207 deletions(-) diff --git a/Src/IronRuby.Tests/Helpers.cs b/Src/IronRuby.Tests/Helpers.cs index 0b32601d..457328bd 100644 --- a/Src/IronRuby.Tests/Helpers.cs +++ b/Src/IronRuby.Tests/Helpers.cs @@ -171,12 +171,6 @@ public static List GetRubyTokens(RubyContext context, ErrorSink log, str return tokens; } - private static int domainId = 0; - - private static AppDomain CreateDomain() { - return AppDomain.CreateDomain("RemoteScripts" + domainId++); - } - [Flags] enum OutputFlags { None = 0, diff --git a/Src/IronRuby.Tests/RubyTests.cs b/Src/IronRuby.Tests/RubyTests.cs index 26b440a1..f357edc0 100644 --- a/Src/IronRuby.Tests/RubyTests.cs +++ b/Src/IronRuby.Tests/RubyTests.cs @@ -106,8 +106,6 @@ public Tests(Driver/*!*/ driver) { Interpreter_JumpFromFinally1, Interpreter_JumpFromFinally2, Interpreter2, - Interpreter3, - Interpreter4, Interpreter5, Interpreter6, InterpreterNumeric1, diff --git a/Src/IronRuby.Tests/Runtime/InterpreterTests.cs b/Src/IronRuby.Tests/Runtime/InterpreterTests.cs index 1825d21f..9a4c4dfc 100644 --- a/Src/IronRuby.Tests/Runtime/InterpreterTests.cs +++ b/Src/IronRuby.Tests/Runtime/InterpreterTests.cs @@ -604,185 +604,6 @@ private void Interpreter2_Test(Func c Assert(comparer(fsc[1], fsi[1])); } - /// - /// ThreadAbortException handling. - /// - [Options(NoRuntime = true)] - public void Interpreter3() { - if (_driver.PartialTrust) return; - - // Thread.Abort throws PlatformNotSupportedException on .NET Core and .NET 5 and later - // (SYSLIB0006), so nothing can raise a ThreadAbortException there: Interpreter3_abort - // got that exception instead and the tracker never saw an abort. The scenario only - // exists on .NET Framework and Mono, which this project no longer targets. - if (!ThreadAbortSupported) return; - - var label = Ast.Label(typeof(void)); - foreach (var gotoLabel in new Expression[] { Ast.Goto(label), Ast.Empty() }) { - var var_tracker = Ast.Parameter(typeof(List)); - var var_abort1 = Ast.Parameter(typeof(ThreadAbortException)); - var var_e = Ast.Parameter(typeof(Exception)); - var var_abort2 = Ast.Parameter(typeof(ThreadAbortException)); - - var m_Interpreter3_abort = new Action(Interpreter3_abort).Method; - var m_Interpreter3_catchAbortThrowNSE = new Action, ThreadAbortException>(Interpreter3_catchAbortThrowNSE).Method; - var m_Interpreter3_catchE = new Action, Exception>(Interpreter3_catchE).Method; - var m_Interpreter3_unreachable = new Action>(Interpreter3_unreachable).Method; - var m_Interpreter3_catchAbort = new Action, ThreadAbortException>(Interpreter3_catchAbort).Method; - - var l = Ast.Lambda>>( - AstUtils.Try( - AstUtils.Try( - AstUtils.Try( - Ast.Call(null, m_Interpreter3_abort) - ).Catch(var_abort1, - Ast.Call(null, m_Interpreter3_catchAbortThrowNSE, var_tracker, var_abort1) - ) - ).Catch(var_e, - Ast.Call(null, m_Interpreter3_catchE, var_tracker, var_e), - gotoLabel - ), - Ast.Call(null, m_Interpreter3_unreachable, var_tracker), - Ast.Label(label, Ast.Call(null, m_Interpreter3_unreachable, var_tracker)) - ).Catch(var_abort2, - Ast.Call(null, m_Interpreter3_catchAbort, var_tracker, var_abort2) - ), - new[] { var_tracker } - ); - - var ctracker = new List(); - var itracker = new List(); - try { - l.Compile()(ctracker); - l.LightCompile()(itracker); - } catch (ThreadAbortException) { - Thread.ResetAbort(); - Assert(false); - return; - } - - foreach (var t in new[] { ctracker, itracker }) { - Assert(t.Count == 10); - Assert(t[0] as string == "1"); - Assert(t[1] is ThreadAbortException); - Assert(t[2] as string == "stateInfo"); - Assert(t[3] as string == "2"); - Assert(t[4] is NotSupportedException); - Assert((ThreadState)t[5] == ThreadState.AbortRequested); - Assert(t[6] as string == "3"); - Assert(t[7] is ThreadAbortException); - Assert(ReferenceEquals(t[8], t[2])); - Assert((ThreadState)t[9] == ThreadState.AbortRequested); - } - } - } - - private static bool ThreadAbortSupported { - get { - string runtime = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; - return runtime.StartsWith(".NET Framework", StringComparison.Ordinal) - || runtime.StartsWith("Mono", StringComparison.Ordinal); - } - } - - public static void Interpreter3_abort() { - Thread.CurrentThread.Abort("stateInfo"); - } - - public static void Interpreter3_catchAbortThrowNSE(List tracker, ThreadAbortException e) { - tracker.Add("1"); - tracker.Add(e); - tracker.Add(e.ExceptionState); - throw new NotSupportedException(); - } - - public static void Interpreter3_catchE(List tracker, Exception e) { - tracker.Add("2"); - tracker.Add(e); - tracker.Add(Thread.CurrentThread.ThreadState); - } - - public static void Interpreter3_unreachable(List tracker) { - tracker.Add("UNREACHABLE"); - } - - public static void Interpreter3_catchAbort(List tracker, ThreadAbortException e) { - tracker.Add("3"); - tracker.Add(e); - tracker.Add(e.ExceptionState); - tracker.Add(Thread.CurrentThread.ThreadState); - Thread.ResetAbort(); - } - - public static void Interpreter4() { - // TODO: figure out if this is specified behavior of thread abort: - - //var var_tracker = Ast.Parameter(typeof(List)); - //var var_abort1 = Ast.Parameter(typeof(ThreadAbortException)); - //var var_abort2 = Ast.Parameter(typeof(ThreadAbortException)); - //var var_abort3 = Ast.Parameter(typeof(ThreadAbortException)); - //var var_abort4 = Ast.Parameter(typeof(ThreadAbortException)); - - //var m_Interpreter4_abort = new Action(Interpreter4_abort).Method; - //var m_Interpreter4_traceE = new Action, ThreadAbortException>(Interpreter4_traceE).Method; - //var m_Interpreter4_traceS = new Action, string>(Interpreter4_traceS).Method; - //var m_Interpreter4_reset = new Action, ThreadAbortException>(Interpreter4_reset).Method; - - //var l = Ast.Lambda>>( - // AstUtils.Try( - // AstUtils.Try( - // Ast.Call(null, m_Interpreter4_abort, Ast.Constant("r1")) - // ).Catch(var_abort1, - // Ast.Call(null, m_Interpreter4_traceE, var_tracker, var_abort1), - // AstUtils.Try( - // AstUtils.Try( - // Ast.Call(null, m_Interpreter4_abort, Ast.Constant("r2")) - // ).Catch(var_abort2, - // Ast.Call(null, m_Interpreter4_traceE, var_tracker, var_abort2) - // ), - // Ast.Call(null, m_Interpreter4_traceS, var_tracker, Ast.Constant("1")) - // ).Catch(var_abort3, - // Ast.Call(null, m_Interpreter4_traceE, var_tracker, var_abort3) - // ), - // Ast.Call(null, m_Interpreter4_traceS, var_tracker, Ast.Constant("2")) - // ), - // Ast.Call(null, m_Interpreter4_traceS, var_tracker, Ast.Constant("2")) - // ).Catch(var_abort4, - // Ast.Call(null, m_Interpreter4_reset, var_tracker, var_abort4) - // ), - // new[] { var_tracker } - //); - - //var ctracker = new List(); - //var itracker = new List(); - //try { - // l.Compile()(ctracker); - // //l.LightCompile()(itracker); - //} catch (ThreadAbortException) { - // Thread.ResetAbort(); - // Assert(false); - // return; - //} - } - - public static void Interpreter4_abort(string value) { - Thread.CurrentThread.Abort(value); - } - - public static void Interpreter4_traceE(List tracker, ThreadAbortException e) { - tracker.Add(e.ExceptionState); - } - - public static void Interpreter4_traceS(List tracker, string s) { - tracker.Add(s); - } - - public static void Interpreter4_reset(List tracker, ThreadAbortException e) { - tracker.Add(e.ExceptionState); - Thread.ResetAbort(); - tracker.Add(e.ExceptionState); - } - [Options(NoRuntime = true)] public void Interpreter5() { var strArray1 = new string[] { "foo" }; diff --git a/Src/Ruby/Runtime/RubyExceptionData.cs b/Src/Ruby/Runtime/RubyExceptionData.cs index b278ca14..0564ddb7 100644 --- a/Src/Ruby/Runtime/RubyExceptionData.cs +++ b/Src/Ruby/Runtime/RubyExceptionData.cs @@ -375,26 +375,10 @@ public void SetCause(Exception cause) { return newException; } -#if FEATURE_THREAD && FEATURE_EXCEPTION_STATE - public static void ActiveExceptionHandled(Exception visibleException) { - Debug.Assert(RubyUtils.GetVisibleException(visibleException) == visibleException); - - RubyExceptionData data = RubyExceptionData.GetInstance(visibleException); - if (data._exception != visibleException) { - // The exception was raised asynchronously with Thread.Abort. We can not just catch and ignore - // the ThreadAbortException as the CLR keeps trying to re-raise it unless ResetAbort is called. - // - // Note that ResetAbort can cause ThreadAbortException.ExceptionState to be cleared (though it may - // not be cleared under some circustances), and we use that to squirrel away the Ruby exception - // that the user is expecting. Hence, ResetAbort should only be called when - // ThreadAbortException.ExceptionState no longer needs to be accessed. - if ((Thread.CurrentThread.ThreadState & System.Threading.ThreadState.AbortRequested) != 0) { - Thread.ResetAbort(); - } - } - } -#else + // A handled exception used to leave a pending Thread.Abort behind when Thread#raise had delivered it + // that way, and Thread.ResetAbort cancelled it here. Thread#raise no longer aborts the target thread + // (see RubyUtils.RaiseAsyncException) and Thread.ResetAbort only throws on .NET Core, so there is + // nothing left to do. public static void ActiveExceptionHandled(Exception visibleException) {} -#endif } } From 98585b49d365523f6fc63ccc057150e33793e9be Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 22:52:55 +0200 Subject: [PATCH 07/13] Say "new" where a member hides one on purpose Range and RubyRegex implement IRubyObjectState themselves, since a literal is frozen, while their generated Subclass keeps a subclass instance's state in its instance data. Because Subclass lists IRubyObject again, interface calls reach its members, so hiding the base's is intended (CS0108). The Stateless template now emits "new" on IsFrozen, IsTainted, IsUntrusted and Freeze for those two, and not for RubyIO, which has no such members. Subclasses.Generated.cs is regenerated by Subclasses.Generator.rb; an unchanged template regenerated byte-identically first. DateTime#to_s and #strftime replace Date's on purpose too. --- Src/Libraries/Date/DateTime.cs | 4 ++-- Src/Ruby/Builtins/Subclasses.Generated.cs | 29 +++++++++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Src/Libraries/Date/DateTime.cs b/Src/Libraries/Date/DateTime.cs index 0750b6ef..bd9fb551 100644 --- a/Src/Libraries/Date/DateTime.cs +++ b/Src/Libraries/Date/DateTime.cs @@ -426,13 +426,13 @@ public static object GetOffset(BinaryOpStorage/*!*/ quo, RubyDate/*!*/ self) { #region formatting [RubyMethod("to_s")] - public static MutableString/*!*/ ToS(RubyDate/*!*/ self) { + public static new MutableString/*!*/ ToS(RubyDate/*!*/ self) { return MutableString.CreateAscii(DateFormatter.Format(self, "%Y-%m-%dT%H:%M:%S%:z")); } /// DateTime#strftime defaults to the full ISO form, not Date's "%F". [RubyMethod("strftime")] - public static MutableString/*!*/ Strftime(RubyDate/*!*/ self, + public static new MutableString/*!*/ Strftime(RubyDate/*!*/ self, [DefaultProtocol, DefaultParameterValue(null)]MutableString format) { if (format == null) { return ToS(self); diff --git a/Src/Ruby/Builtins/Subclasses.Generated.cs b/Src/Ruby/Builtins/Subclasses.Generated.cs index ac802563..9451c029 100644 --- a/Src/Ruby/Builtins/Subclasses.Generated.cs +++ b/Src/Ruby/Builtins/Subclasses.Generated.cs @@ -21,6 +21,7 @@ namespace IronRuby.Builtins { #if GENERATOR Stateless = ['Range', 'RubyRegex', 'RubyIO'] + ImplementObjectStateThemselves = ['Range', 'RubyRegex'] def generate Stateless.each do |cls| @@ -32,6 +33,10 @@ def generate def Class *a @class end + + def New + ImplementObjectStateThemselves.include?(@class) ? 'new ' : '' + end #else public partial class /*$Class{*/Proc/*}*/ { [DebuggerTypeProxy(typeof(RubyObjectDebugView))] @@ -60,21 +65,21 @@ public RubyInstanceData TryGetInstanceData() { return _instanceData; } - public bool IsFrozen { + public /*$New*/bool IsFrozen { get { return _instanceData != null && _instanceData.IsFrozen; } } - public bool IsTainted { + public /*$New*/bool IsTainted { get { return _instanceData != null && _instanceData.IsTainted; } set { GetInstanceData().IsTainted = value; } } - public bool IsUntrusted { + public /*$New*/bool IsUntrusted { get { return _instanceData != null && _instanceData.IsUntrusted; } set { GetInstanceData().IsUntrusted = value; } } - public void Freeze() { + public /*$New*/void Freeze() { GetInstanceData().Freeze(); } @@ -121,21 +126,21 @@ public RubyInstanceData TryGetInstanceData() { return _instanceData; } - public bool IsFrozen { + public new bool IsFrozen { get { return _instanceData != null && _instanceData.IsFrozen; } } - public bool IsTainted { + public new bool IsTainted { get { return _instanceData != null && _instanceData.IsTainted; } set { GetInstanceData().IsTainted = value; } } - public bool IsUntrusted { + public new bool IsUntrusted { get { return _instanceData != null && _instanceData.IsUntrusted; } set { GetInstanceData().IsUntrusted = value; } } - public void Freeze() { + public new void Freeze() { GetInstanceData().Freeze(); } @@ -179,21 +184,21 @@ public RubyInstanceData TryGetInstanceData() { return _instanceData; } - public bool IsFrozen { + public new bool IsFrozen { get { return _instanceData != null && _instanceData.IsFrozen; } } - public bool IsTainted { + public new bool IsTainted { get { return _instanceData != null && _instanceData.IsTainted; } set { GetInstanceData().IsTainted = value; } } - public bool IsUntrusted { + public new bool IsUntrusted { get { return _instanceData != null && _instanceData.IsUntrusted; } set { GetInstanceData().IsUntrusted = value; } } - public void Freeze() { + public new void Freeze() { GetInstanceData().Freeze(); } From 786f2c90ee576d6fae5d7a6112571f75b4eba22b Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 22:55:42 +0200 Subject: [PATCH 08/13] Clear the one-off warnings - RNGCryptoServiceProvider is obsolete (SYSLIB0023); srand and OpenSSL's random bytes come from RandomNumberGenerator.Fill, the same system generator. - The Tls and Tls11 cases of OpenSSL's protocol name (SYSLIB0039) and the UTF-7 encoding constant (SYSLIB0001) stay, with the warning suppressed around them: a connection can still have negotiated TLS 1.0, and UTF-7 is one of Ruby's encodings. - TracePoint.CCallTracing is volatile, which CLS has no notion of (CS3026); it is marked CLSCompliant(false) rather than made internal, since 4.0.0-preview1 shipped it public. - The Time marshal loader's catch filter "!(e is RubyTime)" can never be false, RubyTime not being an exception (CS0184), so the catch says what it did: catch everything. - Oj's StringWriterClass was never assigned (CS0649), so its branch in Oj::Rails.optimize only ever matched nil, and set a flag nothing reads; Oj::StringWriter is not implemented. Nio4r's Monitor._initialized was written and never read (CS0414). Both go. - The fields ReflectionUtilsTests enumerates by reflection keep their pragma (CS0169, CS0649); EncodingConverter drops an unused exception variable (CS0168) and ProcOps a duplicate using (CS0105). --- Src/IronRuby.Tests/DLR/ReflectionUtilsTests.cs | 4 ++++ Src/Libraries/Builtins/EncodingConverter.cs | 2 +- Src/Libraries/Builtins/KernelOps.cs | 8 +------- Src/Libraries/Builtins/ProcOps.cs | 1 - Src/Libraries/Builtins/RubyEncodingOps.cs | 2 ++ Src/Libraries/Builtins/RubyTimeOps.cs | 2 +- Src/Libraries/Nio4r/Nio4r.cs | 2 -- Src/Libraries/Oj/Oj.cs | 1 - Src/Libraries/Oj/OjRails.cs | 2 -- Src/Libraries/OpenSSL/OpenSSL.cs | 8 ++++---- Src/Ruby/Builtins/TracePoint.cs | 1 + 11 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Src/IronRuby.Tests/DLR/ReflectionUtilsTests.cs b/Src/IronRuby.Tests/DLR/ReflectionUtilsTests.cs index d95d175a..ba586a3c 100644 --- a/Src/IronRuby.Tests/DLR/ReflectionUtilsTests.cs +++ b/Src/IronRuby.Tests/DLR/ReflectionUtilsTests.cs @@ -93,6 +93,7 @@ public virtual void PublicVirtualMethod2() { } // fields +#pragma warning disable 169, 649 // fields for GetMembers to find by reflection; nothing reads or writes them public static int A_PublicStaticField; private static int A_PrivateStaticField; protected static int A_ProtectedStaticField; @@ -102,6 +103,7 @@ public virtual void PublicVirtualMethod2() { } private int A_PrivateField; protected int A_ProtectedField; internal int A_InternalField; +#pragma warning restore 169, 649 public int PublicField; @@ -181,6 +183,7 @@ internal override void InternalVirtualMethod() { } // fields +#pragma warning disable 169, 649 // fields for GetMembers to find by reflection; nothing reads or writes them public static int B_PublicStaticField; private static int B_PrivateStaticField; protected static int B_ProtectedStaticField; @@ -190,6 +193,7 @@ internal override void InternalVirtualMethod() { } private int B_PrivateField; protected int B_ProtectedField; internal int B_InternalField; +#pragma warning restore 169, 649 public new int PublicField; diff --git a/Src/Libraries/Builtins/EncodingConverter.cs b/Src/Libraries/Builtins/EncodingConverter.cs index 92746e12..6ab3dbf9 100644 --- a/Src/Libraries/Builtins/EncodingConverter.cs +++ b/Src/Libraries/Builtins/EncodingConverter.cs @@ -329,7 +329,7 @@ internal MutableString/*!*/ Replacement { string chars = value.ToString(); try { return EncodeStageDestination.StrictEncoding.GetBytes(chars); - } catch (EncoderFallbackException e) { + } catch (EncoderFallbackException) { throw new UndefinedConversionError("replacement character setup failed"); } } diff --git a/Src/Libraries/Builtins/KernelOps.cs b/Src/Libraries/Builtins/KernelOps.cs index 99a53e41..247c3881 100644 --- a/Src/Libraries/Builtins/KernelOps.cs +++ b/Src/Libraries/Builtins/KernelOps.cs @@ -2653,21 +2653,15 @@ public static object ReadInputLine(CallSiteStorage> 3]; - var generator = new Crypto.RNGCryptoServiceProvider(); - generator.GetBytes(data); + Crypto.RandomNumberGenerator.Fill(data); uint[] transformed = new uint[data.Length >> 2]; int j = 0; @@ -685,8 +683,10 @@ public static MutableString PeerCertificate(Transport/*!*/ self) { return null; } switch (self._ssl.SslProtocol) { +#pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete, but a connection can still have negotiated one case SslProtocols.Tls: return MutableString.CreateAscii("TLSv1"); case SslProtocols.Tls11: return MutableString.CreateAscii("TLSv1.1"); +#pragma warning restore SYSLIB0039 case SslProtocols.Tls12: return MutableString.CreateAscii("TLSv1.2"); case SslProtocols.Tls13: return MutableString.CreateAscii("TLSv1.3"); default: return MutableString.CreateAscii(self._ssl.SslProtocol.ToString()); diff --git a/Src/Ruby/Builtins/TracePoint.cs b/Src/Ruby/Builtins/TracePoint.cs index 5d62a4e0..0d057d1b 100644 --- a/Src/Ruby/Builtins/TracePoint.cs +++ b/Src/Ruby/Builtins/TracePoint.cs @@ -200,6 +200,7 @@ private void UpdateActiveEvents() { /// /// Whether rules for calls to library methods report :c_call and :c_return. /// + [CLSCompliant(false)] // a volatile field is not CLS-compliant public static volatile bool CCallTracing; #endregion From 5bf78e34dd6c21e70e3592adf2292643cccca36b Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 22:56:36 +0200 Subject: [PATCH 09/13] set_trace_func: suspend tracing on the thread running the trace proc only _traceListenerSuspended keeps the trace proc from tracing its own calls. It was an instance field marked [ThreadStatic], which the runtime ignores on instance fields (CA2259), so the flag was one per context: while one thread ran the trace proc, the events of every other thread were dropped, and whichever thread left the proc first re-enabled tracing under the others. It is static now, like the other per-thread state in RubyContext ($!, $?), so it is per thread as intended. --- Src/Ruby/Runtime/RubyContext.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Src/Ruby/Runtime/RubyContext.cs b/Src/Ruby/Runtime/RubyContext.cs index ae728299..2a324d82 100644 --- a/Src/Ruby/Runtime/RubyContext.cs +++ b/Src/Ruby/Runtime/RubyContext.cs @@ -217,8 +217,9 @@ public Random/*!*/ RandomNumberGenerator { private readonly RubyInputProvider/*!*/ _inputProvider; private Proc _traceListener; + // Set while the trace proc runs on this thread, so that what the proc does is not traced itself. [ThreadStatic] - private bool _traceListenerSuspended; + private static bool _traceListenerSuspended; private readonly Stopwatch _upTime; From 790e015ebea8b2cbca85d2a5d871e699022eccde Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 23:00:22 +0200 Subject: [PATCH 10/13] Ruby.csproj: no System.Text.Encoding.CodePages package on net10.0 The net10.0 shared framework carries System.Text.Encoding.CodePages, so the 10.0.0 package was never what ran and NuGet said so (NU1510). --- Src/Ruby/Ruby.csproj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Src/Ruby/Ruby.csproj b/Src/Ruby/Ruby.csproj index 5288df39..de381a49 100644 --- a/Src/Ruby/Ruby.csproj +++ b/Src/Ruby/Ruby.csproj @@ -10,10 +10,9 @@ - + - From 8f9c3de9334be18d25770ee5294e867325793cdd Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 23:00:23 +0200 Subject: [PATCH 11/13] sqlite3: SQLitePCLRaw 2.1.13, with a SQLite that has the CVE-2025-6965 fix Microsoft.Data.Sqlite 8.0.10 brings SQLitePCLRaw.bundle_e_sqlite3 2.1.6, and SQLitePCLRaw.lib.e_sqlite3 up to 2.1.11 carries a SQLite older than 3.50.2 (GHSA-2m69-gcr7-jv3q); the net10.0 builds flagged it (NU1903). Referencing the bundle at 2.1.13 raises core, provider and native library together, within the 2.1 line that Microsoft.Data.Sqlite.Core asks for (>= 2.1.6). --- Src/Libraries/IronRuby.Libraries.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Src/Libraries/IronRuby.Libraries.csproj b/Src/Libraries/IronRuby.Libraries.csproj index 3b2d155f..3081c600 100644 --- a/Src/Libraries/IronRuby.Libraries.csproj +++ b/Src/Libraries/IronRuby.Libraries.csproj @@ -18,6 +18,9 @@ SQLitePCLRaw, whose bundle_e_sqlite3 carries a native SQLite for linux-x64/win-x64 under runtimes//native. --> + + From 89dd446086a174a546cbcb8edbd2a7fd59871c69 Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 23:06:08 +0200 Subject: [PATCH 12/13] Exceptions: no formatter serialization The (SerializationInfo, StreamingContext) constructors of IronRuby's exception classes chained to .NET's, which are obsolete since .NET 8 (SYSLIB0051, 47 warnings). Following .NET's guidance for exception types, the constructors go (101 of them, the warning-free subclasses too), and so does [Serializable] on every exception class, [NonSerialized] on their fields, and the System.Runtime.Serialization usings nothing needs any more. Nothing in IronRuby used them: Marshal.load rebuilds an exception through CreateException, not through its deserialization constructor, and the one BinaryFormatter round trip of an exception in the tests needs FEATURE_REMOTING. A Ruby class that subclasses an exception gets its CLR type from RubyTypeBuilder, which mirrors whatever constructors the base has. What changes: a BinaryFormatter (net8.0 with the switch on; gone on net9.0 and later) can no longer round-trip an IronRuby exception, and C# code that subclasses one and chains its own serialization constructor to ours no longer compiles. StringScanner's serialization support is the scanner's and stays. --- Src/Libraries/Builtins/Errno.cs | 126 +++-------------- Src/Libraries/Builtins/Exceptions.cs | 40 ++---- Src/Libraries/Fiddle/Fiddle.cs | 16 +-- Src/Libraries/Iconv/Iconv.cs | 35 +---- Src/Libraries/MessagePack/MessagePack.cs | 16 +-- Src/Libraries/Nio4r/Nio4r.cs | 7 +- Src/Libraries/OpenSSL/OpenSSL.cs | 23 +-- Src/Libraries/Puma/PumaHttp11.cs | 3 +- Src/Libraries/Sqlite3/Sqlite3.cs | 82 ++++------- Src/Libraries/StringScanner/StringScanner.cs | 6 +- Src/Libraries/Zlib/zlib.cs | 45 ++---- Src/Ruby/Builtins/Exceptions.cs | 141 ------------------- 12 files changed, 84 insertions(+), 456 deletions(-) diff --git a/Src/Libraries/Builtins/Errno.cs b/Src/Libraries/Builtins/Errno.cs index 9e44e061..5bb72ece 100644 --- a/Src/Libraries/Builtins/Errno.cs +++ b/Src/Libraries/Builtins/Errno.cs @@ -36,7 +36,7 @@ public static class Errno { return new UnauthorizedAccessException(message, inner); } - [RubyClass("EAGAIN"), Serializable] + [RubyClass("EAGAIN")] public class ResourceTemporarilyUnavailableError : ExternalException { private const string/*!*/ M = "Resource temporarily unavailable"; @@ -44,14 +44,9 @@ public ResourceTemporarilyUnavailableError() : this(null, null) { } public ResourceTemporarilyUnavailableError(string message) : this(message, null) { } public ResourceTemporarilyUnavailableError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ResourceTemporarilyUnavailableError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ResourceTemporarilyUnavailableError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("EINTR"), Serializable] + [RubyClass("EINTR")] public class InterruptedError : ExternalException { private const string/*!*/ M = "Interrupted function call"; @@ -59,14 +54,9 @@ public InterruptedError() : this(null, null) { } public InterruptedError(string message) : this(message, null) { } public InterruptedError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public InterruptedError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected InterruptedError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("EDOM"), Serializable] + [RubyClass("EDOM")] public class DomainError : ExternalException { private const string/*!*/ M = "Domain error"; @@ -74,11 +64,6 @@ public DomainError() : this(null, null) { } public DomainError(string message) : this(message, null) { } public DomainError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public DomainError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected DomainError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } [RubyClass("EINVAL", Extends = typeof(InvalidError), Inherits = typeof(ExternalException))] @@ -122,7 +107,7 @@ public class UnauthorizedAccessExceptionOps { } } - [RubyClass("ECHILD"), Serializable] + [RubyClass("ECHILD")] public class ChildError : ExternalException { private const string/*!*/ M = "No child processes"; @@ -130,11 +115,6 @@ public ChildError() : this(null, null) { } public ChildError(string message) : this(message, null) { } public ChildError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ChildError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ChildError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } [RubyClass("EISDIR", Extends = typeof(DirectoryIsError), Inherits = typeof(ExternalException))] @@ -187,7 +167,7 @@ public class ExecFormatErrorOps { } } - [RubyClass("EPERM"), Serializable] + [RubyClass("EPERM")] public class OperationNotPermittedError : ExternalException { private const string/*!*/ M = "Operation not permitted"; @@ -195,14 +175,9 @@ public OperationNotPermittedError() : this(null, null) { } public OperationNotPermittedError(string message) : this(message, null) { } public OperationNotPermittedError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public OperationNotPermittedError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected OperationNotPermittedError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ELOOP"), Serializable] + [RubyClass("ELOOP")] public class TooManySymbolicLinksError : ExternalException { private const string/*!*/ M = "Too many levels of symbolic links"; @@ -210,14 +185,9 @@ public TooManySymbolicLinksError() : this(null, null) { } public TooManySymbolicLinksError(string message) : this(message, null) { } public TooManySymbolicLinksError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public TooManySymbolicLinksError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected TooManySymbolicLinksError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ENOTEMPTY"), Serializable] + [RubyClass("ENOTEMPTY")] public class DirectoryNotEmptyError : ExternalException { private const string/*!*/ M = "Directory not empty"; @@ -225,14 +195,9 @@ public DirectoryNotEmptyError() : this(null, null) { } public DirectoryNotEmptyError(string message) : this(message, null) { } public DirectoryNotEmptyError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public DirectoryNotEmptyError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected DirectoryNotEmptyError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ENAMETOOLONG"), Serializable] + [RubyClass("ENAMETOOLONG")] public class NameTooLongError : ExternalException { private const string/*!*/ M = "File name too long"; @@ -240,14 +205,9 @@ public NameTooLongError() : this(null, null) { } public NameTooLongError(string message) : this(message, null) { } public NameTooLongError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public NameTooLongError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected NameTooLongError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("EPIPE"), Serializable] + [RubyClass("EPIPE")] public class PipeError : ExternalException { private const string/*!*/ M = "Broken pipe"; @@ -255,15 +215,10 @@ public PipeError() : this(null, null) { } public PipeError(string message) : this(message, null) { } public PipeError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public PipeError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected PipeError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("EXDEV"), Serializable] + [RubyClass("EXDEV")] public class ImproperLinkError : ExternalException { private const string/*!*/ M = "Improper link"; @@ -271,14 +226,9 @@ public ImproperLinkError() : this(null, null) { } public ImproperLinkError(string message) : this(message, null) { } public ImproperLinkError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ImproperLinkError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ImproperLinkError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ESPIPE"), Serializable] + [RubyClass("ESPIPE")] public class InvalidSeekError : ExternalException { private const string/*!*/ M = "Invalid seek"; @@ -286,18 +236,13 @@ public InvalidSeekError() : this(null, null) { } public InvalidSeekError(string message) : this(message, null) { } public InvalidSeekError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public InvalidSeekError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected InvalidSeekError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } #region Socket Errors // TODO: generate - [RubyClass("EWOULDBLOCK"), Serializable] + [RubyClass("EWOULDBLOCK")] public class WouldBlockError : ExternalException { private const string/*!*/ M = "A non-blocking socket operation could not be completed immediately."; public override int ErrorCode { get { return 10035; } } @@ -306,14 +251,9 @@ public WouldBlockError() : this(null, null) { } public WouldBlockError(string message) : this(message, null) { } public WouldBlockError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public WouldBlockError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected WouldBlockError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("EADDRINUSE"), Serializable] + [RubyClass("EADDRINUSE")] public class AddressInUseError : ExternalException { private const string/*!*/ M = "Only one usage of each socket address (protocol/network address/port) is normally permitted."; public override int ErrorCode { get { return 10048; } } @@ -322,14 +262,9 @@ public AddressInUseError() : this(null, null) { } public AddressInUseError(string message) : this(message, null) { } public AddressInUseError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public AddressInUseError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected AddressInUseError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ECONNABORTED"), Serializable] + [RubyClass("ECONNABORTED")] public class ConnectionAbortedError : ExternalException { private const string/*!*/ M = "An established connection was aborted by the software in your host machine."; public override int ErrorCode { get { return 10053; } } @@ -338,14 +273,9 @@ public ConnectionAbortedError() : this(null, null) { } public ConnectionAbortedError(string message) : this(message, null) { } public ConnectionAbortedError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ConnectionAbortedError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ConnectionAbortedError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ECONNRESET"), Serializable] + [RubyClass("ECONNRESET")] public class ConnectionResetError : ExternalException { private const string/*!*/ M = "An existing connection was forcibly closed by the remote host."; public override int ErrorCode { get { return 10054; } } @@ -354,14 +284,9 @@ public ConnectionResetError() : this(null, null) { } public ConnectionResetError(string message) : this(message, null) { } public ConnectionResetError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ConnectionResetError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ConnectionResetError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ENOTCONN"), Serializable] + [RubyClass("ENOTCONN")] public class NotConnectedError : ExternalException { private const string/*!*/ M = "A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied."; public override int ErrorCode { get { return 10057; } } @@ -370,14 +295,9 @@ public NotConnectedError() : this(null, null) { } public NotConnectedError(string message) : this(message, null) { } public NotConnectedError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public NotConnectedError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected NotConnectedError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("ECONNREFUSED"), Serializable] + [RubyClass("ECONNREFUSED")] public class ConnectionRefusedError : ExternalException { private const string/*!*/ M = "No connection could be made because the target machine actively refused it."; public override int ErrorCode { get { return 10061; } } @@ -386,14 +306,9 @@ public ConnectionRefusedError() : this(null, null) { } public ConnectionRefusedError(string message) : this(message, null) { } public ConnectionRefusedError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ConnectionRefusedError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ConnectionRefusedError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [RubyClass("EHOSTDOWN"), Serializable] + [RubyClass("EHOSTDOWN")] public class HostDownError : ExternalException { private const string/*!*/ M = "A socket operation failed because the destination host was down."; public override int ErrorCode { get { return 10064; } } @@ -402,11 +317,6 @@ public HostDownError() : this(null, null) { } public HostDownError(string message) : this(message, null) { } public HostDownError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public HostDownError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected HostDownError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } #endregion diff --git a/Src/Libraries/Builtins/Exceptions.cs b/Src/Libraries/Builtins/Exceptions.cs index 8903b6f6..a02cf209 100644 --- a/Src/Libraries/Builtins/Exceptions.cs +++ b/Src/Libraries/Builtins/Exceptions.cs @@ -25,64 +25,46 @@ namespace IronRuby.Builtins { - [RubyException("NoMemoryError"), Serializable] + [RubyException("NoMemoryError")] public class NoMemoryError : Exception { public NoMemoryError() : this(null, null) { } public NoMemoryError(string message): this(message, null) { } public NoMemoryError(string message, Exception inner) : base(message ?? "NoMemoryError", inner) { } - - protected NoMemoryError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("EOFError"), Serializable] + [RubyException("EOFError")] public class EOFError : IOException { public EOFError() : this(null, null) { } public EOFError(string message): this(message, null) { } public EOFError(string message, Exception inner) : base(message ?? "EOFError", inner) { } - - protected EOFError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("FloatDomainError"), Serializable] + [RubyException("FloatDomainError")] public class FloatDomainError : ArgumentOutOfRangeException { public FloatDomainError() : this(null, null) { } public FloatDomainError(string message) : this(message, null) { } public FloatDomainError(string message, Exception inner) : base(message ?? "FloatDomainError", inner) { } - - protected FloatDomainError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("ThreadError"), Serializable] + [RubyException("ThreadError")] public class ThreadError : SystemException { public ThreadError() : this(null, null) { } public ThreadError(string message): this(message, null) { } public ThreadError(string message, Exception inner) : base(message ?? "ThreadError", inner) { } - - protected ThreadError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("StopIteration"), Serializable] + [RubyException("StopIteration")] public class StopIteration : IndexError { public StopIteration() : this(null, null) { } public StopIteration(string message): this(message, null) { } public StopIteration(string message, Exception inner) : base(message ?? "StopIteration", inner) { } - - protected StopIteration(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("ClosedQueueError"), Serializable] + [RubyException("ClosedQueueError")] public class ClosedQueueError : StopIteration { public ClosedQueueError() : this(null, null) { } public ClosedQueueError(string message): this(message, null) { } public ClosedQueueError(string message, Exception inner) : base(message ?? "ClosedQueueError", inner) { } - - protected ClosedQueueError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } [RubyException("SystemExit", Extends = typeof(SystemExit))] @@ -176,24 +158,18 @@ private static bool TryGetStatus(object value, out int status) { } } - [RubyException("SignalException"), Serializable] + [RubyException("SignalException")] public class SignalException : Exception { public SignalException() : this(null, null) { } public SignalException(string message): this(message, null) { } public SignalException(string message, Exception inner) : base(message ?? "SignalException", inner) { } - - protected SignalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("Interrupt", Inherits = typeof(SignalException)), Serializable] + [RubyException("Interrupt", Inherits = typeof(SignalException))] public class Interrupt : Exception { public Interrupt() : this(null, null) { } public Interrupt(string message): this(message, null) { } public Interrupt(string message, Exception inner) : base(message ?? "Interrupt", inner) { } - - protected Interrupt(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } [RubyException("LocalJumpError", Extends = typeof(LocalJumpError))] diff --git a/Src/Libraries/Fiddle/Fiddle.cs b/Src/Libraries/Fiddle/Fiddle.cs index 280869a4..9dd597b9 100644 --- a/Src/Libraries/Fiddle/Fiddle.cs +++ b/Src/Libraries/Fiddle/Fiddle.cs @@ -31,7 +31,6 @@ using System; using System.Numerics; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using IronRuby.Builtins; using IronRuby.Runtime; using Microsoft.Scripting.Runtime; @@ -55,35 +54,26 @@ public static partial class FiddleOps { #region Exceptions - [RubyException("Error"), Serializable] + [RubyException("Error")] public class FiddleError : SystemException { public FiddleError() : this(null, null) { } public FiddleError(string message) : this(message, null) { } public FiddleError(string message, Exception inner) : base(message ?? "Fiddle::Error", inner) { } -#if FEATURE_SERIALIZATION - protected FiddleError(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif } - [RubyException("DLError"), Serializable] + [RubyException("DLError")] public class DLError : FiddleError { public DLError() : this(null, null) { } public DLError(string message) : this(message, null) { } public DLError(string message, Exception inner) : base(message ?? "Fiddle::DLError", inner) { } -#if FEATURE_SERIALIZATION - protected DLError(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif } - [RubyException("ClearedReferenceError"), Serializable] + [RubyException("ClearedReferenceError")] public class ClearedReferenceError : FiddleError { public ClearedReferenceError() : this(null, null) { } public ClearedReferenceError(string message) : this(message, null) { } public ClearedReferenceError(string message, Exception inner) : base(message ?? "Fiddle::ClearedReferenceError", inner) { } -#if FEATURE_SERIALIZATION - protected ClearedReferenceError(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif } #endregion diff --git a/Src/Libraries/Iconv/Iconv.cs b/Src/Libraries/Iconv/Iconv.cs index d3e43742..ed55d9b8 100644 --- a/Src/Libraries/Iconv/Iconv.cs +++ b/Src/Libraries/Iconv/Iconv.cs @@ -244,17 +244,12 @@ private static string GetMessage(object arg2, object arg3) { return string.Format(CultureInfo.InvariantCulture, "{0} {1}", KernelOps.ToS(arg2), KernelOps.ToS(arg3)); } - [RubyException("BrokenLibrary"), Includes(typeof(Failure)), Serializable] + [RubyException("BrokenLibrary"), Includes(typeof(Failure))] public class BrokenLibrary : RuntimeError { public BrokenLibrary() : this(null, null) { } public BrokenLibrary(string message) : this(message, null) { } public BrokenLibrary(string message, Exception inner) : base(message ?? "BrokenLibrary", inner) { } -#if FEATURE_SERIALIZATION - protected BrokenLibrary(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif - [RubyConstructor] public static BrokenLibrary/*!*/ Factory(RubyClass/*!*/ self, object arg1, object arg2, object arg3) { BrokenLibrary result = new BrokenLibrary(GetMessage(arg2, arg3)); @@ -263,17 +258,12 @@ protected BrokenLibrary(System.Runtime.Serialization.SerializationInfo info, Sys } } - [RubyException("InvalidEncoding"), Includes(typeof(Failure)), Serializable] + [RubyException("InvalidEncoding"), Includes(typeof(Failure))] public class InvalidEncoding : ArgumentException { public InvalidEncoding() : this(null, null) { } public InvalidEncoding(string message) : this(message, null) { } public InvalidEncoding(string message, Exception inner) : base(message ?? "InvalidEncoding", inner) { } -#if FEATURE_SERIALIZATION - protected InvalidEncoding(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif - [RubyConstructor] public static InvalidEncoding/*!*/ Factory(RubyClass/*!*/ self, object arg1, object arg2, object arg3) { InvalidEncoding result = new InvalidEncoding(GetMessage(arg2, arg3)); @@ -282,17 +272,12 @@ protected InvalidEncoding(System.Runtime.Serialization.SerializationInfo info, S } } - [RubyException("InvalidCharacter"), Includes(typeof(Failure)), Serializable] + [RubyException("InvalidCharacter"), Includes(typeof(Failure))] public class InvalidCharacter : ArgumentException { public InvalidCharacter() : this(null, null) { } public InvalidCharacter(string message) : this(message, null) { } public InvalidCharacter(string message, Exception inner) : base(message ?? "InvalidCharacter", inner) { } -#if FEATURE_SERIALIZATION - protected InvalidCharacter(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif - [RubyConstructor] public static InvalidCharacter/*!*/ Factory(RubyClass/*!*/ self, object arg1, object arg2, object arg3) { InvalidCharacter result = new InvalidCharacter(GetMessage(arg2, arg3)); @@ -301,17 +286,12 @@ protected InvalidCharacter(System.Runtime.Serialization.SerializationInfo info, } } - [RubyException("IllegalSequence"), Includes(typeof(Failure)), Serializable] + [RubyException("IllegalSequence"), Includes(typeof(Failure))] public class IllegalSequence : ArgumentException { public IllegalSequence() : this(null, null) { } public IllegalSequence(string message) : this(message, null) { } public IllegalSequence(string message, Exception inner) : base(message ?? "IllegalSequence", inner) { } -#if FEATURE_SERIALIZATION - protected IllegalSequence(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif - [RubyConstructor] public static IllegalSequence/*!*/ Factory(RubyClass/*!*/ self, object arg1, object arg2, object arg3) { IllegalSequence result = new IllegalSequence(GetMessage(arg2, arg3)); @@ -320,17 +300,12 @@ protected IllegalSequence(System.Runtime.Serialization.SerializationInfo info, S } } - [RubyException("OutOfRange"), Includes(typeof(Failure)), Serializable] + [RubyException("OutOfRange"), Includes(typeof(Failure))] public class OutOfRange : RuntimeError { public OutOfRange() : this(null, null) { } public OutOfRange(string message) : this(message, null) { } public OutOfRange(string message, Exception inner) : base(message ?? "OutOfRange", inner) { } -#if FEATURE_SERIALIZATION - protected OutOfRange(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif - [RubyConstructor] public static OutOfRange/*!*/ Factory(RubyClass/*!*/ self, object arg1, object arg2, object arg3) { OutOfRange result = new OutOfRange(GetMessage(arg2, arg3)); diff --git a/Src/Libraries/MessagePack/MessagePack.cs b/Src/Libraries/MessagePack/MessagePack.cs index 53cece09..2aa6a013 100644 --- a/Src/Libraries/MessagePack/MessagePack.cs +++ b/Src/Libraries/MessagePack/MessagePack.cs @@ -23,7 +23,6 @@ using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using IronRuby.Builtins; using IronRuby.Runtime; using IronRuby.Runtime.Calls; @@ -403,44 +402,39 @@ public static class MessagePackOps { #region errors - [RubyException("UnpackError"), Serializable] + [RubyException("UnpackError")] public class UnpackError : SystemException { public UnpackError() : this(null, null) { } public UnpackError(string message) : this(message, null) { } public UnpackError(string message, Exception inner) : base(message ?? "MessagePack::UnpackError", inner) { } - protected UnpackError(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("MalformedFormatError"), Serializable] + [RubyException("MalformedFormatError")] public class MalformedFormatError : UnpackError { public MalformedFormatError() : this(null, null) { } public MalformedFormatError(string message) : this(message, null) { } public MalformedFormatError(string message, Exception inner) : base(message ?? "MessagePack::MalformedFormatError", inner) { } - protected MalformedFormatError(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("StackError"), Serializable] + [RubyException("StackError")] public class StackError : UnpackError { public StackError() : this(null, null) { } public StackError(string message) : this(message, null) { } public StackError(string message, Exception inner) : base(message ?? "MessagePack::StackError", inner) { } - protected StackError(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("UnexpectedTypeError"), Serializable] + [RubyException("UnexpectedTypeError")] public class UnexpectedTypeError : UnpackError { public UnexpectedTypeError() : this(null, null) { } public UnexpectedTypeError(string message) : this(message, null) { } public UnexpectedTypeError(string message, Exception inner) : base(message ?? "MessagePack::UnexpectedTypeError", inner) { } - protected UnexpectedTypeError(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("UnknownExtTypeError"), Serializable] + [RubyException("UnknownExtTypeError")] public class UnknownExtTypeError : UnpackError { public UnknownExtTypeError() : this(null, null) { } public UnknownExtTypeError(string message) : this(message, null) { } public UnknownExtTypeError(string message, Exception inner) : base(message ?? "MessagePack::UnknownExtTypeError", inner) { } - protected UnknownExtTypeError(SerializationInfo info, StreamingContext context) : base(info, context) { } } #endregion diff --git a/Src/Libraries/Nio4r/Nio4r.cs b/Src/Libraries/Nio4r/Nio4r.cs index 27678ca5..e0a7cd7e 100644 --- a/Src/Libraries/Nio4r/Nio4r.cs +++ b/Src/Libraries/Nio4r/Nio4r.cs @@ -31,7 +31,6 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using System.Threading; using IronRuby.Builtins; using IronRuby.Runtime; @@ -948,21 +947,21 @@ public ByteBuffer(RubyClass/*!*/ rubyClass) : base(rubyClass) { return new ByteBuffer(ImmediateClass.NominalClass); } - [RubyException("OverflowError"), Serializable] + [RubyException("OverflowError")] public class OverflowError : System.IO.IOException { public OverflowError() : this(null, null) { } public OverflowError(string message) : this(message, null) { } public OverflowError(string message, Exception inner) : base(message ?? "OverflowError", inner) { } } - [RubyException("UnderflowError"), Serializable] + [RubyException("UnderflowError")] public class UnderflowError : System.IO.IOException { public UnderflowError() : this(null, null) { } public UnderflowError(string message) : this(message, null) { } public UnderflowError(string message, Exception inner) : base(message ?? "UnderflowError", inner) { } } - [RubyException("MarkUnsetError"), Serializable] + [RubyException("MarkUnsetError")] public class MarkUnsetError : System.IO.IOException { public MarkUnsetError() : this(null, null) { } public MarkUnsetError(string message) : this(message, null) { } diff --git a/Src/Libraries/OpenSSL/OpenSSL.cs b/Src/Libraries/OpenSSL/OpenSSL.cs index 536aefdd..55e9af5a 100644 --- a/Src/Libraries/OpenSSL/OpenSSL.cs +++ b/Src/Libraries/OpenSSL/OpenSSL.cs @@ -61,17 +61,12 @@ public static class OpenSsl { public class Digest { // MRI's class for "this is not a digest OpenSSL knows"; code rescues it // by name, so it has to be this class and not its OpenSSLError parent. - [RubyException("DigestError"), Serializable] + [RubyException("DigestError")] public class DigestError : OpenSSLError { public DigestError() : this(null, null) { } public DigestError(string message) : this(message, null) { } public DigestError(string message, Exception inner) : base(message ?? "DigestError", inner) { } public DigestError(MutableString message) : base(message.ConvertToString()) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected DigestError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } private string/*!*/ _name = "SHA1"; @@ -421,7 +416,7 @@ public static class KDF { } } - [RubyException("KDFError"), Serializable] + [RubyException("KDFError")] public class KDFError : OpenSSLError { public KDFError() : this(null, null) { } public KDFError(string message) : this(message, null) { } @@ -543,17 +538,12 @@ public class Name { // MRI's OpenSSL exceptions are plain StandardErrors: the message is exactly what was given, // not the " - " form of SystemCallError. - [RubyException("OpenSSLError"), Serializable] + [RubyException("OpenSSLError")] public class OpenSSLError : SystemException { public OpenSSLError() : this(null, null) { } public OpenSSLError(string message) : this(message, null) { } public OpenSSLError(string message, Exception inner) : base(message ?? "OpenSSLError", inner) { } public OpenSSLError(MutableString message) : base(message.ConvertToString()) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected OpenSSLError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } [RubyModule("SSL")] @@ -710,17 +700,12 @@ public static int Pending(Transport/*!*/ self) { } #endif - [RubyException("SSLError"), Serializable] + [RubyException("SSLError")] public class SSLError : OpenSSLError { public SSLError() : this(null, null) { } public SSLError(string message) : this(message, null) { } public SSLError(string message, Exception inner) : base(message ?? "SSLError", inner) { } public SSLError(MutableString message) : base(message.ConvertToString()) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected SSLError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } } } diff --git a/Src/Libraries/Puma/PumaHttp11.cs b/Src/Libraries/Puma/PumaHttp11.cs index ba5eb33d..48c85c1d 100644 --- a/Src/Libraries/Puma/PumaHttp11.cs +++ b/Src/Libraries/Puma/PumaHttp11.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; -using System.Runtime.Serialization; using System.Text; using IronRuby.Builtins; using IronRuby.Runtime; @@ -40,7 +39,7 @@ namespace IronRuby.StandardLibrary.Puma { [RubyModule("Puma")] public static class PumaModule { - [RubyException("HttpParserError"), Serializable] + [RubyException("HttpParserError")] public class HttpParserError : SystemException { public HttpParserError() : this(null, null) { } public HttpParserError(string message) : this(message, null) { } diff --git a/Src/Libraries/Sqlite3/Sqlite3.cs b/Src/Libraries/Sqlite3/Sqlite3.cs index 42c84773..7a411ffb 100644 --- a/Src/Libraries/Sqlite3/Sqlite3.cs +++ b/Src/Libraries/Sqlite3/Sqlite3.cs @@ -25,7 +25,6 @@ using System.Collections.Generic; using System.Numerics; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using System.Text; using IronRuby.Builtins; using IronRuby.Runtime; @@ -137,220 +136,193 @@ internal static int ErrorOffset(sqlite3 db) { /// and read by attr_readers in Src/StdLib/ironruby/sqlite3/errors.rb, the way /// KeyError#key is done in the core (see StringFormatter.CreateKeyError). /// - [RubyException("Exception"), Serializable] + [RubyException("Exception")] public class SqliteException : SystemException { public SqliteException() : this(null, null) { } public SqliteException(string message) : this(message, null) { } public SqliteException(string message, Exception inner) : base(message ?? "SQLite3::Exception", inner) { } - protected SqliteException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("SQLException"), Serializable] + [RubyException("SQLException")] public class SQLException : SqliteException { public SQLException() : this(null, null) { } public SQLException(string message) : this(message, null) { } public SQLException(string message, Exception inner) : base(message ?? "SQLException", inner) { } - protected SQLException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("InternalException"), Serializable] + [RubyException("InternalException")] public class InternalException : SqliteException { public InternalException() : this(null, null) { } public InternalException(string message) : this(message, null) { } public InternalException(string message, Exception inner) : base(message ?? "InternalException", inner) { } - protected InternalException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("PermissionException"), Serializable] + [RubyException("PermissionException")] public class PermissionException : SqliteException { public PermissionException() : this(null, null) { } public PermissionException(string message) : this(message, null) { } public PermissionException(string message, Exception inner) : base(message ?? "PermissionException", inner) { } - protected PermissionException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("AbortException"), Serializable] + [RubyException("AbortException")] public class AbortException : SqliteException { public AbortException() : this(null, null) { } public AbortException(string message) : this(message, null) { } public AbortException(string message, Exception inner) : base(message ?? "AbortException", inner) { } - protected AbortException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("BusyException"), Serializable] + [RubyException("BusyException")] public class BusyException : SqliteException { public BusyException() : this(null, null) { } public BusyException(string message) : this(message, null) { } public BusyException(string message, Exception inner) : base(message ?? "BusyException", inner) { } - protected BusyException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("LockedException"), Serializable] + [RubyException("LockedException")] public class LockedException : SqliteException { public LockedException() : this(null, null) { } public LockedException(string message) : this(message, null) { } public LockedException(string message, Exception inner) : base(message ?? "LockedException", inner) { } - protected LockedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("MemoryException"), Serializable] + [RubyException("MemoryException")] public class MemoryException : SqliteException { public MemoryException() : this(null, null) { } public MemoryException(string message) : this(message, null) { } public MemoryException(string message, Exception inner) : base(message ?? "MemoryException", inner) { } - protected MemoryException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("ReadOnlyException"), Serializable] + [RubyException("ReadOnlyException")] public class ReadOnlyException : SqliteException { public ReadOnlyException() : this(null, null) { } public ReadOnlyException(string message) : this(message, null) { } public ReadOnlyException(string message, Exception inner) : base(message ?? "ReadOnlyException", inner) { } - protected ReadOnlyException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("InterruptException"), Serializable] + [RubyException("InterruptException")] public class InterruptException : SqliteException { public InterruptException() : this(null, null) { } public InterruptException(string message) : this(message, null) { } public InterruptException(string message, Exception inner) : base(message ?? "InterruptException", inner) { } - protected InterruptException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("IOException"), Serializable] + [RubyException("IOException")] public class IOException : SqliteException { public IOException() : this(null, null) { } public IOException(string message) : this(message, null) { } public IOException(string message, Exception inner) : base(message ?? "IOException", inner) { } - protected IOException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("CorruptException"), Serializable] + [RubyException("CorruptException")] public class CorruptException : SqliteException { public CorruptException() : this(null, null) { } public CorruptException(string message) : this(message, null) { } public CorruptException(string message, Exception inner) : base(message ?? "CorruptException", inner) { } - protected CorruptException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("NotFoundException"), Serializable] + [RubyException("NotFoundException")] public class NotFoundException : SqliteException { public NotFoundException() : this(null, null) { } public NotFoundException(string message) : this(message, null) { } public NotFoundException(string message, Exception inner) : base(message ?? "NotFoundException", inner) { } - protected NotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("FullException"), Serializable] + [RubyException("FullException")] public class FullException : SqliteException { public FullException() : this(null, null) { } public FullException(string message) : this(message, null) { } public FullException(string message, Exception inner) : base(message ?? "FullException", inner) { } - protected FullException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("CantOpenException"), Serializable] + [RubyException("CantOpenException")] public class CantOpenException : SqliteException { public CantOpenException() : this(null, null) { } public CantOpenException(string message) : this(message, null) { } public CantOpenException(string message, Exception inner) : base(message ?? "CantOpenException", inner) { } - protected CantOpenException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("ProtocolException"), Serializable] + [RubyException("ProtocolException")] public class ProtocolException : SqliteException { public ProtocolException() : this(null, null) { } public ProtocolException(string message) : this(message, null) { } public ProtocolException(string message, Exception inner) : base(message ?? "ProtocolException", inner) { } - protected ProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("EmptyException"), Serializable] + [RubyException("EmptyException")] public class EmptyException : SqliteException { public EmptyException() : this(null, null) { } public EmptyException(string message) : this(message, null) { } public EmptyException(string message, Exception inner) : base(message ?? "EmptyException", inner) { } - protected EmptyException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("SchemaChangedException"), Serializable] + [RubyException("SchemaChangedException")] public class SchemaChangedException : SqliteException { public SchemaChangedException() : this(null, null) { } public SchemaChangedException(string message) : this(message, null) { } public SchemaChangedException(string message, Exception inner) : base(message ?? "SchemaChangedException", inner) { } - protected SchemaChangedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("TooBigException"), Serializable] + [RubyException("TooBigException")] public class TooBigException : SqliteException { public TooBigException() : this(null, null) { } public TooBigException(string message) : this(message, null) { } public TooBigException(string message, Exception inner) : base(message ?? "TooBigException", inner) { } - protected TooBigException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("ConstraintException"), Serializable] + [RubyException("ConstraintException")] public class ConstraintException : SqliteException { public ConstraintException() : this(null, null) { } public ConstraintException(string message) : this(message, null) { } public ConstraintException(string message, Exception inner) : base(message ?? "ConstraintException", inner) { } - protected ConstraintException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("MismatchException"), Serializable] + [RubyException("MismatchException")] public class MismatchException : SqliteException { public MismatchException() : this(null, null) { } public MismatchException(string message) : this(message, null) { } public MismatchException(string message, Exception inner) : base(message ?? "MismatchException", inner) { } - protected MismatchException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("MisuseException"), Serializable] + [RubyException("MisuseException")] public class MisuseException : SqliteException { public MisuseException() : this(null, null) { } public MisuseException(string message) : this(message, null) { } public MisuseException(string message, Exception inner) : base(message ?? "MisuseException", inner) { } - protected MisuseException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("UnsupportedException"), Serializable] + [RubyException("UnsupportedException")] public class UnsupportedException : SqliteException { public UnsupportedException() : this(null, null) { } public UnsupportedException(string message) : this(message, null) { } public UnsupportedException(string message, Exception inner) : base(message ?? "UnsupportedException", inner) { } - protected UnsupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("AuthorizationException"), Serializable] + [RubyException("AuthorizationException")] public class AuthorizationException : SqliteException { public AuthorizationException() : this(null, null) { } public AuthorizationException(string message) : this(message, null) { } public AuthorizationException(string message, Exception inner) : base(message ?? "AuthorizationException", inner) { } - protected AuthorizationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("FormatException"), Serializable] + [RubyException("FormatException")] public class FormatException : SqliteException { public FormatException() : this(null, null) { } public FormatException(string message) : this(message, null) { } public FormatException(string message, Exception inner) : base(message ?? "FormatException", inner) { } - protected FormatException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("RangeException"), Serializable] + [RubyException("RangeException")] public class RangeException : SqliteException { public RangeException() : this(null, null) { } public RangeException(string message) : this(message, null) { } public RangeException(string message, Exception inner) : base(message ?? "RangeException", inner) { } - protected RangeException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - [RubyException("NotADatabaseException"), Serializable] + [RubyException("NotADatabaseException")] public class NotADatabaseException : SqliteException { public NotADatabaseException() : this(null, null) { } public NotADatabaseException(string message) : this(message, null) { } public NotADatabaseException(string message, Exception inner) : base(message ?? "NotADatabaseException", inner) { } - protected NotADatabaseException(SerializationInfo info, StreamingContext context) : base(info, context) { } } /// diff --git a/Src/Libraries/StringScanner/StringScanner.cs b/Src/Libraries/StringScanner/StringScanner.cs index d2728fc4..5b8db7b7 100644 --- a/Src/Libraries/StringScanner/StringScanner.cs +++ b/Src/Libraries/StringScanner/StringScanner.cs @@ -35,15 +35,11 @@ namespace IronRuby.StandardLibrary.StringScanner { [RubyClass("StringScanner")] public sealed class StringScanner : RubyObject { - [RubyException("Error"), Serializable] + [RubyException("Error")] public class Error : SystemException { public Error() : this(null, null) { } public Error(string message) : this(message, null) { } public Error(string message, Exception inner) : base(message ?? "Error", inner) { } - -#if FEATURE_SERIALIZATION - protected Error(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif } private MutableString/*!*/ _scanString; diff --git a/Src/Libraries/Zlib/zlib.cs b/Src/Libraries/Zlib/zlib.cs index f74b9a4c..fb3f4ab9 100644 --- a/Src/Libraries/Zlib/zlib.cs +++ b/Src/Libraries/Zlib/zlib.cs @@ -1243,94 +1243,67 @@ public static object DeflateString(ConversionStorage/*!*/ fixnumCast, Block #region Exceptions - [RubyException("Error"), Serializable] + [RubyException("Error")] public class Error : SystemException { public Error() : this(null, null) { } public Error(string message) : this(message, null) { } public Error(string message, Exception inner) : base(message ?? "Error", inner) { } - - protected Error(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("StreamEnd"), Serializable] + [RubyException("StreamEnd")] public class StreamEnd : Error { public StreamEnd() : this(null, null) { } public StreamEnd(string message) : this(message, null) { } public StreamEnd(string message, Exception inner) : base(message ?? "StreamEnd", inner) { } - - protected StreamEnd(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("NeedDict"), Serializable] + [RubyException("NeedDict")] public class NeedDict : Error { public NeedDict() : this(null, null) { } public NeedDict(string message) : this(message, null) { } public NeedDict(string message, Exception inner) : base(message ?? "NeedDict", inner) { } - - protected NeedDict(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("DataError"), Serializable] + [RubyException("DataError")] public class DataError : Error { public DataError() : this(null, null) { } public DataError(string message) : this(message, null) { } public DataError(string message, Exception inner) : base(message ?? "DataError", inner) { } - - protected DataError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("BufError"), Serializable] + [RubyException("BufError")] public class BufError : Error { public BufError() : this(null, null) { } public BufError(string message) : this(message, null) { } public BufError(string message, Exception inner) : base(message ?? "BufError", inner) { } - - protected BufError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("MemError"), Serializable] + [RubyException("MemError")] public class MemError : Error { public MemError() : this(null, null) { } public MemError(string message) : this(message, null) { } public MemError(string message, Exception inner) : base(message ?? "MemError", inner) { } - - protected MemError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("VersionError"), Serializable] + [RubyException("VersionError")] public class VersionError : Error { public VersionError() : this(null, null) { } public VersionError(string message) : this(message, null) { } public VersionError(string message, Exception inner) : base(message ?? "VersionError", inner) { } - - protected VersionError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("InProgressError"), Serializable] + [RubyException("InProgressError")] public class InProgressError : Error { public InProgressError() : this(null, null) { } public InProgressError(string message) : this(message, null) { } public InProgressError(string message, Exception inner) : base(message ?? "InProgressError", inner) { } - - protected InProgressError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } - [RubyException("StreamError"), Serializable] + [RubyException("StreamError")] public class StreamError : Error { public StreamError() : this(null, null) { } public StreamError(string message) : this(message, null) { } public StreamError(string message, Exception inner) : base(message ?? "StreamError", inner) { } - - protected StreamError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } } #endregion diff --git a/Src/Ruby/Builtins/Exceptions.cs b/Src/Ruby/Builtins/Exceptions.cs index 4c316ba6..c6b0e927 100644 --- a/Src/Ruby/Builtins/Exceptions.cs +++ b/Src/Ruby/Builtins/Exceptions.cs @@ -20,9 +20,7 @@ namespace IronRuby.Builtins { - [Serializable] public class LocalJumpError : SystemException { - [NonSerialized] private readonly RuntimeFlowControl _skipFrame; /// @@ -32,10 +30,8 @@ internal RuntimeFlowControl SkipFrame { get { return _skipFrame; } } - [NonSerialized] private readonly string _reason; - [NonSerialized] private readonly object _exitValue; /// @@ -74,14 +70,8 @@ internal LocalJumpError(string/*!*/ message, RuntimeFlowControl/*!*/ skipFrame, public LocalJumpError() : this(null, (Exception)null) { } public LocalJumpError(string message) : this(message, (Exception)null) { } public LocalJumpError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected LocalJumpError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class SystemExit : Exception { private int _status; @@ -107,129 +97,68 @@ public SystemExit(int status) public SystemExit() : this(null, null) { } public SystemExit(string message) : this(message, null) { } public SystemExit(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected SystemExit(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class ScriptError : Exception { public ScriptError() : this(null, null) { } public ScriptError(string message) : this(message, null) { } public ScriptError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected ScriptError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class NotImplementedError : ScriptError { public NotImplementedError() : this(null, null) { } public NotImplementedError(string message) : this(message, null) { } public NotImplementedError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected NotImplementedError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class LoadError : ScriptError { public LoadError() : this(null, null) { } public LoadError(string message) : this(message, null) { } public LoadError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected LoadError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class SystemStackError : SystemException { public SystemStackError() : this(null, null) { } public SystemStackError(string message) : this(message, null) { } public SystemStackError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected SystemStackError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } /// /// Ruby's IndexError. Not System.IndexOutOfRangeException, which is sealed: KeyError and /// StopIteration (and Ruby classes) have to be able to subclass it. /// - [Serializable] public class IndexError : SystemException { public IndexError() : this(null, null) { } public IndexError(string message) : this(message, null) { } public IndexError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected IndexError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class RegexpError : SystemException { public RegexpError() : this(null, null) { } public RegexpError(string message) : this(message, null) { } public RegexpError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected RegexpError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class EncodingError : SystemException { public EncodingError() : this(null, null) { } public EncodingError(string message) : this(message, null) { } public EncodingError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected EncodingError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class EncodingCompatibilityError : EncodingError { public EncodingCompatibilityError() : this(null, null) { } public EncodingCompatibilityError(string message) : this(message, null) { } public EncodingCompatibilityError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected EncodingCompatibilityError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class UndefinedConversionError : EncodingError { public UndefinedConversionError() : this(null, null) { } public UndefinedConversionError(string message) : this(message, null) { } public UndefinedConversionError(string message, Exception inner) : base(message, inner) { } -#if FEATURE_SERIALIZATION - protected UndefinedConversionError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif - /// The encoding the failing conversion stage read from. May be null. - [NonSerialized] private RubyEncoding _sourceEncoding, _destinationEncoding; - [NonSerialized] private byte[] _errorCharBytes; public RubyEncoding SourceEncoding { get { return _sourceEncoding; } set { _sourceEncoding = value; } } @@ -239,26 +168,17 @@ protected UndefinedConversionError(System.Runtime.Serialization.SerializationInf public byte[] ErrorCharBytes { get { return _errorCharBytes; } set { _errorCharBytes = value; } } } - [Serializable] public class InvalidByteSequenceError : EncodingError { public InvalidByteSequenceError() : this(null, null) { } public InvalidByteSequenceError(string message) : this(message, null) { } public InvalidByteSequenceError(string message, Exception inner) : base(message, inner) { } -#if FEATURE_SERIALIZATION - protected InvalidByteSequenceError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif - - [NonSerialized] private RubyEncoding _sourceEncoding, _destinationEncoding; - [NonSerialized] private byte[] _errorBytes, _readAgainBytes; // Nullable: an error object that was not produced by a conversion has not been told // either way, and MRI's #incomplete_input? answers nil for it. - [NonSerialized] private bool? _incompleteInput; public RubyEncoding SourceEncoding { get { return _sourceEncoding; } set { _sourceEncoding = value; } } @@ -274,28 +194,16 @@ protected InvalidByteSequenceError(System.Runtime.Serialization.SerializationInf public bool? IncompleteInput { get { return _incompleteInput; } set { _incompleteInput = value; } } } - [Serializable] public class ConverterNotFoundError : EncodingError { public ConverterNotFoundError() : this(null, null) { } public ConverterNotFoundError(string message) : this(message, null) { } public ConverterNotFoundError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected ConverterNotFoundError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class RuntimeError : SystemException { public RuntimeError() : this(null, null) { } public RuntimeError(string message) : this(message, null) { } public RuntimeError(string message, Exception inner) : base(message, inner) { } - -#if FEATURE_SERIALIZATION - protected RuntimeError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } /// @@ -316,7 +224,6 @@ protected RuntimeError(System.Runtime.Serialization.SerializationInfo info, Syst /// KernelOps.Throw's counterpart in the core needs it; the registration is the usual /// one-liner in Src/Libraries/Builtins/Exceptions.cs. /// - [Serializable] public class UncaughtThrowError : ArgumentException { private readonly object _tag; private readonly object _value; @@ -339,7 +246,6 @@ public object Value { } } - [Serializable] public class FrozenError : RuntimeError { private object _receiver; private bool _hasReceiver; @@ -364,14 +270,8 @@ public FrozenError SetReceiver(object receiver) { _hasReceiver = true; return this; } - -#if FEATURE_SERIALIZATION - protected FrozenError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class SyntaxError : ScriptError { private readonly string _file; private readonly string _lineSourceCode; @@ -414,14 +314,8 @@ internal SyntaxError(string/*!*/ message, string file, int line, int column, str _lineSourceCode = lineSourceCode; _hasLineInfo = true; } - -#if FEATURE_SERIALIZATION - protected SyntaxError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class ExistError : ExternalException { private const string/*!*/ M = "File exists"; @@ -429,14 +323,8 @@ public ExistError() : this(null, null) { } public ExistError(string message) : this(message, null) { } public ExistError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ExistError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ExistError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class BadFileDescriptorError : ExternalException { private const string/*!*/ M = "Bad file descriptor"; @@ -444,11 +332,6 @@ public BadFileDescriptorError() : this(null, null) { } public BadFileDescriptorError(string message) : this(message, null) { } public BadFileDescriptorError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public BadFileDescriptorError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected BadFileDescriptorError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } /// @@ -456,7 +339,6 @@ protected BadFileDescriptorError(System.Runtime.Serialization.SerializationInfo /// directory throws UnauthorizedAccessException, which maps to EACCES -- so the /// runtime needs a type of its own to raise. Registered in Errno.cs. /// - [Serializable] public class DirectoryIsError : ExternalException { private const string/*!*/ M = "Is a directory"; @@ -464,14 +346,8 @@ public DirectoryIsError() : this(null, null) { } public DirectoryIsError(string message) : this(message, null) { } public DirectoryIsError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public DirectoryIsError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected DirectoryIsError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class ExecFormatError : ExternalException { private const string/*!*/ M = "Exec format error"; @@ -479,11 +355,6 @@ public ExecFormatError() : this(null, null) { } public ExecFormatError(string message) : this(message, null) { } public ExecFormatError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public ExecFormatError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected ExecFormatError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } /// @@ -491,7 +362,6 @@ protected ExecFormatError(System.Runtime.Serialization.SerializationInfo info, S /// /dev/tty, a FIFO opened for writing with no reader - as a bare IOException, which /// would otherwise surface as IOError. Registered in Errno.cs. /// - [Serializable] public class NoSuchDeviceOrAddressError : ExternalException { private const string/*!*/ M = "No such device or address"; @@ -499,14 +369,8 @@ public NoSuchDeviceOrAddressError() : this(null, null) { } public NoSuchDeviceOrAddressError(string message) : this(message, null) { } public NoSuchDeviceOrAddressError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public NoSuchDeviceOrAddressError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected NoSuchDeviceOrAddressError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } - [Serializable] public class InvalidError : ExternalException { private const string/*!*/ M = "Invalid argument"; @@ -514,11 +378,6 @@ public InvalidError() : this(null, null) { } public InvalidError(string message) : this(message, null) { } public InvalidError(string message, Exception inner) : base(RubyExceptions.MakeMessage(message, M), inner) { } public InvalidError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M)) { RubyExceptionData.InitializeException(this, message); } - -#if FEATURE_SERIALIZATION - protected InvalidError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } -#endif } } From 0f5c2ca99b69dffddbd18378848581e3de7c0a39 Mon Sep 17 00:00:00 2001 From: Largo Date: Wed, 30 Sep 2026 23:06:10 +0200 Subject: [PATCH 13/13] Keep the two serialization APIs that are still used, with the warning suppressed SerializationInfo, FormatterConverter and StreamingContext (SYSLIB0050) in RubyUtils.CreateObject are how Marshal.load hands a Ruby object's instance variables to its deserialization constructor; no formatter is involved, and the types work on .NET 8 and 10. RubyEncoding.Deserializer's IObjectReference gives a BinaryFormatter the RubyEncoding singleton back; Serialization1 exercises it on net8.0, where the tests switch BinaryFormatter on. --- Src/Ruby/Builtins/RubyEncoding.cs | 2 ++ Src/Ruby/Runtime/RubyUtils.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Src/Ruby/Builtins/RubyEncoding.cs b/Src/Ruby/Builtins/RubyEncoding.cs index d3b37f27..546e80f1 100644 --- a/Src/Ruby/Builtins/RubyEncoding.cs +++ b/Src/Ruby/Builtins/RubyEncoding.cs @@ -191,7 +191,9 @@ private RubyEncoding(SerializationInfo/*!*/ info, StreamingContext context) { } [Serializable] +#pragma warning disable SYSLIB0050 // IObjectReference: BinaryFormatter gets the RubyEncoding singleton back (net8.0, Serialization1) internal sealed class Deserializer : ISerializable, IObjectReference { +#pragma warning restore SYSLIB0050 private readonly int _codePage; private Deserializer(SerializationInfo/*!*/ info, StreamingContext context) { diff --git a/Src/Ruby/Runtime/RubyUtils.cs b/Src/Ruby/Runtime/RubyUtils.cs index 2f7bc2ed..468a724d 100644 --- a/Src/Ruby/Runtime/RubyUtils.cs +++ b/Src/Ruby/Runtime/RubyUtils.cs @@ -1481,12 +1481,14 @@ private static bool EvaluateBlock(BlockParam/*!*/ block, RubyModule/*!*/ module, string message = String.Format("Class {0} does not have a valid deserializing constructor", baseType.FullName); throw new NotSupportedException(message); } +#pragma warning disable SYSLIB0050 // Marshal.load hands the instance variables to the deserialization constructor; no formatter involved SerializationInfo info = new SerializationInfo(baseType, new FormatterConverter()); info.AddValue(SerializationInfoClassKey, theclass); foreach (var pair in attributes) { info.AddValue(pair.Key, pair.Value); } obj = ci.Invoke(new object[2] { info, new StreamingContext(StreamingContextStates.Other, theclass) }); +#pragma warning restore SYSLIB0050 } else { obj = CreateObject(theclass); foreach (var pair in attributes) {