Skip to content

Conversation

@claudiamurialdo
Copy link
Collaborator

According to the suggestion at dotnet/runtime#418
Issue:91913

Move duplicate code in GxRedis.cs and GxMemcached.cs to GxClasses.csproj
Adding the package reference System.Text.Json to GxClasses.csproj gets a conflict with System.Net.Http. Because of that, HttpClient used in MapFunctions.cs is replaced by HttpWebRequest for .netframework similar to the use in GXGeolocation.

…he suggestion in dotnet/runtime#418

Move duplicate code in GxRedis.cs and GxMemcached.cs to GxClasses.csproj
Adding the package reference System.Text.Json to GxClasses.csproj gets a conflict with System.Net.Http. Because of that, HttpClient used in MapFunctions.cs is replaced by HttpWebRequest for .netframework similar to the use in GXGeolocation.
@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@claudiamurialdo claudiamurialdo temporarily deployed to external-storage-tests October 26, 2021 15:00 Inactive
@claudiamurialdo claudiamurialdo changed the title Add a converter to serialize properly the DBNull value Add a converter to serialize properly DBNull value Oct 26, 2021
@claudiamurialdo claudiamurialdo temporarily deployed to external-storage-tests October 26, 2021 15:01 Inactive
#if !NETCORE
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(new Uri(urlString));
req.Method = "GET";
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Moreover, I removed the unused code.

{
string info = readStream.ReadToEnd();
}
rStream.Close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use "using" instead of .Close() ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. The unnecessary code was removed.

{
using (HttpContent content = response.Content)
{
string info = content.ReadAsStringAsync().Result;
Copy link
Member

@ggallotti ggallotti Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is not part of this commit, sorry!. But look what weird it is this.
The Web Response "info" string is read from the Stream, but not used anywhere?

Also, if the HttpRequest fails (crashes), Exception would ocurr. Maybe we can add a try-catch and log the error? What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No doubt about it. I removed that unnecessary code.

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@claudiamurialdo claudiamurialdo temporarily deployed to external-storage-tests October 26, 2021 20:43 Inactive
@claudiamurialdo claudiamurialdo merged commit fbfe50c into master Oct 26, 2021
@claudiamurialdo claudiamurialdo deleted the memcached-serialization branch October 26, 2021 20:51
claudiamurialdo added a commit that referenced this pull request Oct 26, 2021
* Add a converter to serialize properly the DBNull value according to the suggestion in dotnet/runtime#418
Move duplicate code in GxRedis.cs and GxMemcached.cs to GxClasses.csproj
Adding the package reference System.Text.Json to GxClasses.csproj gets a conflict with System.Net.Http. Because of that, HttpClient used in MapFunctions.cs is replaced by HttpWebRequest for .netframework similar to the use in GXGeolocation.

* Remove unused code.

(cherry picked from commit fbfe50c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants