Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FabricException ErrorCode changed to Unknown when thrown via Remoting #208

Open
0shi opened this issue Jun 14, 2019 · 2 comments
Open

FabricException ErrorCode changed to Unknown when thrown via Remoting #208

0shi opened this issue Jun 14, 2019 · 2 comments
Assignees
Labels

Comments

@0shi
Copy link

0shi commented Jun 14, 2019

Describe the bug
A FabricException thrown from user code and returned to another service via Remoting has an ErrorCode property of Unknown when observed at the calling service, regardless of its original ErrorCode.
The HResult appears unchanged, as a workaround we will check the HResult as well as the ErrorCode.

To Reproduce
Source of exception - A Service that will be interacted with via SF Remoting

public async Task DoStuff()   
{   
   var ex = new FabricException(FabricErrorCode.OperationTimedOut);
   throw ex;
}

Reader of exception - A service with a Polly for retrying transient exceptions:

await policy.ExecuteAsync(async () =>   
{   
   // Assume we already have a proxy
   await proxy.DoStuff().ConfigureAwait(false);
}

Expected behavior
ErrorCode is the same at the source and the caller.

Additional context
Observed while developing a retry wrapper around SF Remoting operations for transient SF exceptions and intentionally throwing a FabricException from user code to test the wrapper. Unsure if the same behaviour would be present if the FabricException had originated in the SF internals.

@suchiagicha
Copy link

@0shi
Yes , it is expected to not work. We don't use that way. We use Errorcode property only for interop layer.
Why you are using FabricException. This is very much tied to ServiceFabric.

@0shi
Copy link
Author

0shi commented Jun 23, 2019

I'm no longer on this project, but @MagicalFan should be able to answer any follow-up questions.

We encountered this when we were testing our retry policy by intentionally throwing an exception in one service and retrying it in another. If I understand this response correctly, any FabricExceptions thrown across to another Service will have a code of Unknown, and this is intentional?
Can we rely on the hresult, or is it expected that it's impossible for FabricExceptions to be thrown to user code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants