The error you’re encountering, “Received an invalid status line: ‘0’”, is a known issue that some developers have reported when using the Microsoft.Graph SDK in .NET applications. This error typically occurs when the SDK encounters an unexpected response from the server.
Here are a few suggestions that might help you troubleshoot this issue:
Update the SDK: Although you mentioned that updating the SDK could introduce breaking changes, it’s possible that this issue has been addressed in a newer version of the SDK. It might be worth considering this option if other solutions don’t work.
- Check the Access Token: Ensure that your application is presenting a valid access token to Microsoft Graph as part of the request. This error often means that the access token may be missing in the HTTP authenticate request header or that the token is invalid or has expired.
- Set the “Accept” Header: Try setting the “Accept” header explicitly in your request. Some developers have found that this can help avoid issues with unexpected server responses.
Reproduce the Issue Outside the SDK: You mentioned that you couldn’t reproduce the issue using the Graph Explorer. If possible, try to reproduce the issue using a different method (like a simple HTTP client) to see if the issue is specific to the SDK or if it’s a more general issue with the Graph API.
Remember, these are just suggestions and might solve your specific issue. Good luck! 😊
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".