Your suggestion to use a ByteArrayInputStream
seems like a viable workaround. You could try modify it manually in the local environment and see if it resolves the deadlock issue.
Ultimately. I would be recommend that you file this issue in the official Microsoft Graph SDK GitHub repository. for the SDK team to review and investigate it. They may provide a fix or suggest another workaround.
You can create a new issue here: Microsoft Graph SDK GitHub Repository. Be sure to include all relevant details and code samples.