Unable to read ReadOnly Encoder

Hello everyone,

I’m working on deploying a custom GUI with bunch of custom-made wrappers for serial hardware. All of the wrappers are working when I use TUI, and my basic and comparison steps seem to be working just fine when I use my custom GUI. However, I am getting this weird set of errors about the encoder.

Serializer ; Error ; XML Line 7: Unable to read EncoderReplacementFallback. Instance is read-only.

Can anyone tell me what XML this is referring to? Line 7 of the tapplan that the GUI is feeding into OpenTAP is:

<TestStep type="OpenTap.Plugins.BasicSteps.SequenceStep" Id="7180e4ff-6d05-47e7-a598-0fb2ed973fa3">

I’d like to figure out how to fix this Encoder/Decoder problem, as I’m having other issues and trying to ensure that this isn’t causing them.

I’m loading TapPlans from a database. The TapPlans contain multiple references to other TapPlans that have all been “converted to sequence” using the TUI Convert to Sequence option.

Relevant log section is below:

2025-06-30 15:08:35.301057 ; PluginManager  ; Debug       ; Searched 176 Assemblies. [146 ms]
2025-06-30 15:08:35.301545 ; AssemblyData   ; Debug       ; Loaded OpenTap. [163 us]
2025-06-30 15:08:35.301562 ; AssemblyData   ; Debug       ; Loaded OpenTap.Plugins.BasicSteps. [235 us]
2025-06-30 15:08:35.301575 ; AssemblyData   ; Debug       ; Loaded OpenTap.Package. [169 us]
2025-06-30 15:08:35.301725 ; AssemblyData   ; Debug       ; Loaded OpenTap.Python. [157 us]
2025-06-30 15:08:35.326755 ; Python         ; Debug       ; Loading: UsbTmcDevice-Python.TmcInstrument
2025-06-30 15:08:35.327097 ; AssemblyData   ; Debug       ; Loaded . [900 ns]
2025-06-30 15:08:35.327145 ; AssemblyData   ; Debug       ; Loaded . [200 ns]
2025-06-30 15:08:35.327165 ; AssemblyData   ; Debug       ; Loaded . [100 ns]
2025-06-30 15:08:35.327180 ; AssemblyData   ; Debug       ; Loaded . [100 ns]
2025-06-30 15:08:35.327195 ; AssemblyData   ; Debug       ; Loaded . [100 ns]
2025-06-30 15:08:35.328335 ; AssemblyData   ; Debug       ; Loaded . [1.20 us]
2025-06-30 15:08:35.328389 ; Python         ; Debug       ; Loading: UsbTmcDevice.TmcInstrument
2025-06-30 15:08:35.328571 ; AssemblyData   ; Debug       ; Loaded . [300 ns]
2025-06-30 15:08:35.333088 ; AssemblyData   ; Debug       ; Loaded System.Private.CoreLib. [1.60 us]
2025-06-30 15:08:35.342461 ; AssemblyData   ; Debug       ; Loaded AC_Power_Supply. [518 us]
2025-06-30 15:08:35.343767 ; Resolver       ; Debug       ; Found match for RJCP.SerialPortStream, Version=3.0.3.0, Culture=neutral, PublicKeyToken=5f5e7b70c6a74deb in /opt/sts/Packages/SerialInstrument/RJCP.SerialPortStream.dll
2025-06-30 15:08:35.344749 ; Resolver       ; Debug       ; Found match for RJCP.IO.Buffer, Version=0.2.2.0, Culture=neutral, PublicKeyToken=5f5e7b70c6a74deb in /opt/sts/Packages/SerialInstrument/RJCP.IO.Buffer.dll
2025-06-30 15:08:35.347514 ; AssemblyData   ; Debug       ; Loaded SerialInstrument. [184 us]
2025-06-30 15:08:35.359489 ; AssemblyData   ; Debug       ; Loaded RJCP.SerialPortStream. [127 us]
2025-06-30 15:08:35.360512 ; Resolver       ; Debug       ; Found match for RJCP.Diagnostics.Trace, Version=0.2.1.0, Culture=neutral, PublicKeyToken=5f5e7b70c6a74deb in /opt/sts/Packages/SerialInstrument/RJCP.Diagnostics.Trace.dll
2025-06-30 15:08:35.361297 ; Resolver       ; Debug       ; Found match for RJCP.Core.SysCompat, Version=0.2.0.0, Culture=neutral, PublicKeyToken=5f5e7b70c6a74deb in /opt/sts/Packages/SerialInstrument/RJCP.Core.SysCompat.dll
2025-06-30 15:08:35.363618 ; Resolver       ; Debug       ; Found match for RJCP.Core.Environment, Version=0.3.0.0, Culture=neutral, PublicKeyToken=5f5e7b70c6a74deb in /opt/sts/Packages/SerialInstrument/RJCP.Core.Environment.dll
2025-06-30 15:08:35.419777 ; Serializer     ; Error       ; XML Line 7: Unable to read EncoderReplacementFallback. Instance is read-only.
2025-06-30 15:08:35.420966 ; Serializer     ; Debug       ; InvalidOperationException: Instance is read-only.
2025-06-30 15:08:35.421238 ; Serializer     ; Debug       ;     at System.Text.Encoding.set_EncoderFallback(EncoderFallback value)
2025-06-30 15:08:35.421244 ; Serializer     ; Debug       ;     at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
2025-06-30 15:08:35.421246 ; Serializer     ; Debug       ;     at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
2025-06-30 15:08:35.423202 ; Serializer     ; Debug       ; Exception caught at:
2025-06-30 15:08:35.424412 ; Serializer     ; Debug       ;     at Void LogMessages()
2025-06-30 15:08:35.424454 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.Xml.Linq.XDocument, OpenTap.ITypeData, Boolean, System.String)
2025-06-30 15:08:35.424466 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.IO.Stream, Boolean, OpenTap.ITypeData, System.String)
2025-06-30 15:08:35.424475 ; Serializer     ; Debug       ;     at OpenTap.ComponentSettings Load(System.Type)
2025-06-30 15:08:35.424502 ; Serializer     ; Debug       ;     ...
2025-06-30 15:08:35.424527 ; Serializer     ; Error       ; XML Line 8: Unable to read DecoderReplacementFallback. Instance is read-only.
2025-06-30 15:08:35.424531 ; Serializer     ; Debug       ; InvalidOperationException: Instance is read-only.
2025-06-30 15:08:35.424605 ; Serializer     ; Debug       ;     at System.Text.Encoding.set_DecoderFallback(DecoderFallback value)
2025-06-30 15:08:35.424606 ; Serializer     ; Debug       ;     at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
2025-06-30 15:08:35.424607 ; Serializer     ; Debug       ;     at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
2025-06-30 15:08:35.424735 ; Serializer     ; Debug       ; Exception caught at:
2025-06-30 15:08:35.424778 ; Serializer     ; Debug       ;     at Void LogMessages()
2025-06-30 15:08:35.424780 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.Xml.Linq.XDocument, OpenTap.ITypeData, Boolean, System.String)
2025-06-30 15:08:35.424781 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.IO.Stream, Boolean, OpenTap.ITypeData, System.String)
2025-06-30 15:08:35.424782 ; Serializer     ; Debug       ;     at OpenTap.ComponentSettings Load(System.Type)
2025-06-30 15:08:35.424785 ; Serializer     ; Debug       ;     ...
2025-06-30 15:08:35.424789 ; Serializer     ; Error       ; XML Line 50: Unable to read EncoderReplacementFallback. Instance is read-only.
2025-06-30 15:08:35.424790 ; Serializer     ; Debug       ; InvalidOperationException: Instance is read-only.
2025-06-30 15:08:35.424838 ; Serializer     ; Debug       ;     at System.Text.Encoding.set_EncoderFallback(EncoderFallback value)
2025-06-30 15:08:35.424840 ; Serializer     ; Debug       ;     at InvokeStub_Encoding.set_EncoderFallback(Object, Object, IntPtr*)
2025-06-30 15:08:35.424841 ; Serializer     ; Debug       ;     at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
2025-06-30 15:08:35.424929 ; Serializer     ; Debug       ; Exception caught at:
2025-06-30 15:08:35.424942 ; Serializer     ; Debug       ;     at Void LogMessages()
2025-06-30 15:08:35.424943 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.Xml.Linq.XDocument, OpenTap.ITypeData, Boolean, System.String)
2025-06-30 15:08:35.424944 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.IO.Stream, Boolean, OpenTap.ITypeData, System.String)
2025-06-30 15:08:35.424945 ; Serializer     ; Debug       ;     at OpenTap.ComponentSettings Load(System.Type)
2025-06-30 15:08:35.424946 ; Serializer     ; Debug       ;     ...
2025-06-30 15:08:35.424948 ; Serializer     ; Error       ; XML Line 51: Unable to read DecoderReplacementFallback. Instance is read-only.
2025-06-30 15:08:35.424949 ; Serializer     ; Debug       ; InvalidOperationException: Instance is read-only.
2025-06-30 15:08:35.424973 ; Serializer     ; Debug       ;     at System.Text.Encoding.set_DecoderFallback(DecoderFallback value)
2025-06-30 15:08:35.424974 ; Serializer     ; Debug       ;     at InvokeStub_Encoding.set_DecoderFallback(Object, Object, IntPtr*)
2025-06-30 15:08:35.424976 ; Serializer     ; Debug       ;     at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
2025-06-30 15:08:35.425101 ; Serializer     ; Debug       ; Exception caught at:
2025-06-30 15:08:35.425139 ; Serializer     ; Debug       ;     at Void LogMessages()
2025-06-30 15:08:35.425143 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.Xml.Linq.XDocument, OpenTap.ITypeData, Boolean, System.String)
2025-06-30 15:08:35.425146 ; Serializer     ; Debug       ;     at System.Object Deserialize(System.IO.Stream, Boolean, OpenTap.ITypeData, System.String)
2025-06-30 15:08:35.425149 ; Serializer     ; Debug       ;     at OpenTap.ComponentSettings Load(System.Type)
2025-06-30 15:08:35.425151 ; Serializer     ; Debug       ;     ...

Thanks for your help.

Hi @matthewdumas,

I think the problem is that some test step contains information that should not have been serialized. Maybe a setting called EncoderReplacementFallback and DecoderReplacementFallback.

Maybe these should have been ignored with the XmlIgnore attribute or have been internal/private?

This is before any test step has been executed.

I’m not sure what XML is being referenced though. Is it the Instruments.xml file, my tapplan, or something else?

This comes from a settings file. Maybe you could look through your settings files (Settings) folder and check line 50/51 in all files to see whats there.

I’ll do that and report back.

The rest of my issues came from a corrupted database entry. It looks like the data was only half entered in every column for some reason.

1 Like