Input code
public static class ResponseMessageExtensions
{
public static void EnsureSuccessStatusCodeEx(this HttpResponseMessage responseMessage)
{
if (!responseMessage.IsSuccessStatusCode)
{
var responseText = responseMessage.Content.ReadAsStringAsync().Result;
var contentType = responseMessage.Content.Headers.ContentType;
throw new WebApiRequestException(responseMessage.ReasonPhrase, responseMessage.StatusCode, responseText, responseMessage.Headers, contentType);
}
}
}
Erroneous output
Imports System.Runtime.CompilerServices
Public Module ResponseMessageExtensions
<Extension()>
Public Sub EnsureSuccessStatusCodeEx(Me responseMessage As HttpResponseMessage)
If Not responseMessage.IsSuccessStatusCode Then
Dim responseText = responseMessage.Content.ReadAsStringAsync().Result
Dim contentType = responseMessage.Content.Headers.ContentType
Throw New WebApiRequestException(responseMessage.ReasonPhrase, responseMessage.StatusCode, responseText, responseMessage.Headers, contentType)
End If
End Sub
End Module
Expected output
Module ResponseMessageExtensions
<Extension()>
Public Sub EnsureSuccessStatusCodeEx(ByVal _responseMessage As HttpResponseMessage)
If Not _responseMessage.IsSuccessStatusCode Then
Dim responseText = _responseMessage.Content.ReadAsStringAsync().Result
Dim contentType = _responseMessage.Content.Headers.ContentType
Throw New WebApiRequestException(_responseMessage.ReasonPhrase, _responseMessage.StatusCode, responseText, _responseMessage.Headers, contentType)
End If
End Sub
End Module
According to: https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods
I am using https://icsharpcode.github.io/CodeConverter/ as of today.
Input code
Erroneous output
Expected output
According to: https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods
I am using https://icsharpcode.github.io/CodeConverter/ as of today.