MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.26k stars 21.43k forks source link

Remoting exception serialization overview doesn't say what to do with uses of FabricTransportServiceRemotingProviderAttribute #121346

Closed acarrazzoni-qontigo closed 6 months ago

acarrazzoni-qontigo commented 6 months ago

The remoting exception serialization overview page doesn't explain what to do if the FabricTransportServiceRemotingProviderAttribute is used to configure listeners


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

PesalaPavan commented 6 months ago

@acarrazzoni-qontigo Thanks for your feedback! We will investigate and update as appropriate.

AjayBathini-MSFT commented 6 months ago

@acarrazzoni-qontigo

Thank you for bringing this to our attention. You are correct that the Remoting Exception Serialization Overview page does not provide guidance on how to handle exceptions when using the FabricTransportServiceRemotingProviderAttribute to configure listeners.

When using the FabricTransportServiceRemotingProviderAttribute, exceptions are serialized and deserialized automatically by the Service Fabric runtime. This is because the FabricTransportServiceRemotingProviderAttribute uses a binary message format that is optimized for performance and does not require explicit serialization.

To handle exceptions when using the FabricTransportServiceRemotingProviderAttribute, you can catch the exception in your service code and return an appropriate error message to the client. The Service Fabric runtime will automatically serialize the error message and send it back to the client.

For example, you can catch an exception in your service code and return an error message as follows:

try { // Code that may throw an exception } catch (Exception ex) { return Task.FromResult(new MyResponse { ErrorMessage = ex.Message }); } In this example, the MyResponse class contains an ErrorMessage property that is set to the exception message. The Task.FromResult method is used to return the error message as a Task object.

I hope this helps provide some guidance on how to handle exceptions when using the FabricTransportServiceRemotingProviderAttribute. If you have any further questions or concerns, please let me know.

acarrazzoni-qontigo commented 6 months ago

@AjayBathini-MSFT

This is because the FabricTransportServiceRemotingProviderAttribute uses a binary message format that is optimized for performance and does not require explicit serialization.

Does that format use the BinaryFormatter? If so, will it continue to work in NET 8? The NET 8 documentation says the BinaryFormatter is disabled for all projects except Windows Forms and WPF projects. What can I do instead of handling exceptions in the service code?

AjayBathini-MSFT commented 6 months ago

@acarrazzoni-qontigo

Thank you for your feedback! I'd recommend working closer with our support team via an [Azure support request] (https://docs.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request). Or you can leverage our Q&A forum by posting your issue there so our community, and MVPs can further assist you in troubleshooting this issue or finding potential workarounds. [Teams Q&A forum] (https://docs.microsoft.com/en-us/answers/topics/46488/office-teams-windows-itpro.html) for technical questions about the configuration and administration of Microsoft Teams on Windows. [Microsoft Teams Community forum] (https://answers.microsoft.com/en-us/msteams/forum?sort=LastReplyDate&dir=Desc&tab=All&status=all&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=All&isFilterExpanded=false&page=1) Thank you for your time and patience throughout this issue.