You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the v1.1.0 code, it looks like Rest.Request is making a network call to api.nuget.org prior to every call to the SMSGlobal REST service. I believe this is unnecessary and wasteful.
The purpose seems to be obtaining the latest version of the package to put in the User-Agent header. It seems to me like it would be more valuable to include the currently running package version.
Suggestions to fix:
If possible, eliminate the call to api.nuget.org, and use the current assembly's version. (For example, using typeof(Client).Assembly.GetName().Version.)
If the Nuget call is necessary for some reason, call it once and cache the result in a singleton, or similar.
If the Nuget call is necessary as part of every call, as it's coded now, add comments to explain why.
Also please note that the HttpClient instantiated on line 375 (as of tag 1.1.0) is not properly disposed.
The text was updated successfully, but these errors were encountered:
We had an outage due to this hidden gem in the SDK. The nuget endpoint was returning an application/xml response for some reason (perhaps nuget had a disruption) which caused all SMS global requests to fail within the SDK.
System.Net.Http.UnsupportedMediaTypeException: No MediaTypeFormatter is available to read an object of type 'VersionsResponse' from content with media type 'application/xml'
The call to nuget is crazy and i'm left wondering how this implementation has been left in the SDK for so many years now or how it was allowed to exist in the first place...
Based on the v1.1.0 code, it looks like
Rest.Request
is making a network call toapi.nuget.org
prior to every call to the SMSGlobal REST service. I believe this is unnecessary and wasteful.The purpose seems to be obtaining the latest version of the package to put in the
User-Agent
header. It seems to me like it would be more valuable to include the currently running package version.Suggestions to fix:
api.nuget.org
, and use the current assembly's version. (For example, usingtypeof(Client).Assembly.GetName().Version
.)Also please note that the
HttpClient
instantiated on line 375 (as of tag 1.1.0) is not properly disposed.The text was updated successfully, but these errors were encountered: