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

[#6771] Fix Attachment issue when it has a MemoryStream instance #6850

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

sw-joelmut
Copy link
Collaborator

Fixes #6771

Description

This PR fixes an issue with DLASE when a MemoryStream instance is being used as an Activity.Attachment, e.g. a file. The ReadTimeout issue is caused when trying to serialize the non-serializable MemoryStream instance.

Specific Changes

  • Adds the AttachmentMemoryStreamConverter to serialize and deserialize a MemoryStream instance.
    • Serialize (WriteJson): It recursively searches and replaces all instances of MemoryStream to a serializable class, containing a type and a buffer array.
    • Deserialize (ReadJson): It recursivelly searches and converts all objects of type MemoryStream to a MemoryStream instance with the buffer array.
  • Adds unit tests to cover cases previous to the JsonConverter addition, and using the JsonConverter.

Testing

The following images show the bot working, and the unit tests passing.
image
image

@sw-joelmut sw-joelmut requested a review from a team as a code owner September 17, 2024 17:36
@sw-joelmut sw-joelmut added the Automation: No parity PR does not need to be applied to other languages. label Sep 17, 2024
@sw-joelmut
Copy link
Collaborator Author

Im looking at the failing tests

@BruceHaley
Copy link
Contributor

✔️ No Binary Compatibility issues for Microsoft.Bot.Schema.dll

@tracyboehrer tracyboehrer merged commit c11b7fd into main Sep 17, 2024
10 checks passed
@tracyboehrer tracyboehrer deleted the southworks/fix/attachment-memorystream branch September 17, 2024 21:17
tracyboehrer pushed a commit that referenced this pull request Sep 19, 2024
* Fix Attachment issue when it has a MemoryStream instance

* Fix unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation: No parity PR does not need to be applied to other languages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File Attachment gives error in private endpoint enabled bot
3 participants