Repository navigation
[Instrumentation.ServiceFabricRemoting] Support custom exception convertors - #5166
Merged
martincostello merged 6 commits intoSep 9, 2026
Merged
martincostello merged 6 commits into
martincostello merged 6 commits into
Conversation
…ertors Service Fabric SDK 8 (runtime 11) stopped enabling the BinaryFormatter fallback for remoting exception serialization by default, and SDK 9 (runtime 12) removes it altogether. See the Remoting V1 deprecation strategy: https://github.com/microsoft/service-fabric/blob/master/release_notes/Deprecated/RemotingV1.md Up to SDK 7.1 the defaults were BinaryFormatter on the listener and Fallback on the client, which round-tripped any [Serializable] exception with no configuration. From SDK 8 both default to data contract serialization, so an exception type is only preserved if an IExceptionConvertor is registered for it; anything else reaches the client as a ServiceException wrapped in an AggregateException, and "catch (MyCustomException)" stops matching. The provider attributes built the listener and the client factory internally and called the Service Fabric overloads that take no convertors, so applications using them had no way to opt in. - Unseal both provider attributes and add GetServiceExceptionConvertors() and GetClientExceptionConvertors() hooks, passing the results to the Service Fabric listener and client factory overloads that accept exception convertors. This extends the existing Service Fabric provider-attribute model rather than introducing a new abstraction, and keeps real convertor instances so they can take dependencies. - Add a RemotingExceptionDepth property to control how many levels of inner exceptions are serialized. - Document the manual composition path in the README. Both adapters are already public, so applications needing full control over listener or client factory construction can wrap their own objects directly. This was previously undocumented. Behaviour is unchanged by default: the hooks return null, and RemotingExceptionDepth only overrides the Service Fabric default when set. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b9928e0c-3bbc-46f5-9ad5-55b0a69b4a44
Pull request dashboard statusMerged · refreshed 2026-09-10 17:10 UTC Status above doesn't look right?
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5166 +/- ##
==========================================
- Coverage 79.03% 78.98% -0.05%
==========================================
Files 499 499
Lines 20941 20890 -51
==========================================
- Hits 16551 16501 -50
+ Misses 4390 4389 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…tests The actor provider attribute had no coverage for the new exception convertor hooks. Mirror the service provider tests so that both attributes exercise the default (no convertors registered) and derived (custom convertors registered) paths, and the RemotingExceptionDepth property. The listener creation and client factory construction in both attributes remain uncovered because they instantiate Service Fabric transport objects that require the Service Fabric runtime, which is not available on the CI agents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b9928e0c-3bbc-46f5-9ad5-55b0a69b4a44
An editing mistake joined the opening brace with the first constructor, which StyleCop flagged as SA1500 and SA1025 and broke the build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b9928e0c-3bbc-46f5-9ad5-55b0a69b4a44
martincostello
approved these changes
Sep 7, 2026
- Remove the documentation entry from the CHANGELOG, per review feedback that documentation-only changes are not usually listed there. - Drop the redundant empty argument list from the assembly attribute example. - Note that the derived attribute still accepts the Service Fabric settings inherited from the base attribute. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b9928e0c-3bbc-46f5-9ad5-55b0a69b4a44
martincostello
approved these changes
Sep 8, 2026
This was referenced Sep 21, 2026
This was referenced Sep 25, 2026
Open
This was referenced Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Service Fabric lets applications register
IExceptionConvertorimplementationsso that custom exception types survive a remoting call. The provider attributes
in this package build the listener and the client factory internally and call
the Service Fabric overloads that take no convertors, so applications using them
have no way to opt in.
This became a problem in Service Fabric SDK 8 (runtime 11), which stopped
enabling the
BinaryFormatterfallback for remoting exception serialization bydefault; SDK 9 (runtime 12) removes it altogether. See the
Remoting V1 deprecation strategy.
Up to SDK 7.1 the defaults were
BinaryFormatteron the listener andFallbackon the client, which round-tripped any
[Serializable]exception with noconfiguration. From SDK 8 an exception type is only preserved if a convertor is
registered for it; anything else reaches the client as a
ServiceExceptionwrapped in an
AggregateException, socatch (MyCustomException)stopsmatching.
TraceContextEnrichedServiceRemotingProviderAttributeandTraceContextEnrichedActorRemotingProviderAttributeand addGetServiceExceptionConvertors()/GetClientExceptionConvertors()hooks,passing the results to the Service Fabric listener and client factory
overloads that accept exception convertors. This extends the existing Service
Fabric provider-attribute model rather than introducing a new abstraction, and
keeps real convertor instances so they can take dependencies.
RemotingExceptionDepthproperty to control how many levels of innerexceptions are serialized.
public, so applications needing full control over listener or client factory
construction can wrap their own objects directly. This was previously
undocumented.
Behaviour is unchanged by default: the hooks return
null, andRemotingExceptionDepthonly overrides the Service Fabric default when set.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes