Skip to content

Conversation

@shmatt
Copy link

@shmatt shmatt commented Jan 8, 2020

Hi,

I've included some changes here that we've made internally.

  • Updates to Newtonsoft Version
  • Fix for InvoiceStatus
  • Ability to download binary data, and therefore implemented InvoiceProxy.GenerateInvoicePdf
  • Changed BaseProxy to use a singleton of HttpClient, as discussed in raised issue.

Copy link
Contributor

@SaasuDev SaasuDev left a comment

Choose a reason for hiding this comment

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

Please don't change the nuspec file or include packages you have generated. Please do not downgrade the framework version. Also see my comments about your http client changes. Even though the old was using .result it still allowed multiple clients to be created. I would advise you to split your generate invoice pdf change from the base proxy change. As that will be easier to approve.

</runtime>

</configuration> No newline at end of file
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this added?

Copy link
Author

Choose a reason for hiding this comment

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

Because I needed to use it in a project already including a higher version of Newtonsoft.Json than 7

<RootNamespace>Saasu.API.Client.IntegrationTests</RootNamespace>
<AssemblyName>Saasu.API.Client.IntegrationTests</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you changing the target framework?

Copy link
Author

Choose a reason for hiding this comment

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

My project was 4.6.1, and I couln't otherwise use the library. Upgrading my framework version led to other issues. I made this change before I intended the pull request.

Copy link
Author

Choose a reason for hiding this comment

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

PS. It's not a downgrade. Nuget packages should target the lowest possible framework that supports it, so it can be used as widely as possible. Packages targeted for a lower version framework can be used in a project using a higher version framework, but packages with a higher version framework can't be used in a project with a lower version.

<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net471" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net471" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you downgrading the target framework?

Copy link
Author

Choose a reason for hiding this comment

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

As above

<Saasu.API.Client.Config>
<setting name="IgnoreSSLErrors" serializeAs="String">
<value>false</value>
<value>true</value>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this value changed?

Copy link
Author

Choose a reason for hiding this comment

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

I'm getting connection SSL errors, though likely because I can't create an outbound connection. The HTTPClient stops working after a few hours after launch. This wasn't intended as part of the pull request.

: new JsonMediaTypeFormatter());
}

return client.SendAsync(request).Result;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going to block the call and it won't be async. These changes will only allow a single http request at a time, where before multiple would have been supported.

Copy link
Author

Choose a reason for hiding this comment

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

No, I don't think so. HttpClient is intended to be shared, and is reentrant and thread safe. Unless I'm missing something.

See https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

<RootNamespace>Saasu.API.Client</RootNamespace>
<AssemblyName>Saasu.API.Client</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
Copy link
Contributor

Choose a reason for hiding this comment

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

Downgrade

<id>Saasu.API.Dotnet.Sdk</id>
<title>API SDK for the Saasu API</title>
<version>1.1.7</version>
<version>1.1.7.2</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't change the nuspec file. We will do this for a release.

Copy link
Author

Choose a reason for hiding this comment

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

This commit was not intended to be a part of the pull request. Because there was no response to our request, we made this change internally so we could push to our private nuget repository without conflicts.

<version>1.1.7.2</version>
<authors>Saasu</authors>
<description>A client SDK for working with the Saasu API.</description>
<description>A client SDK for working with the Saasu API. Modified for Intellis internal use.</description>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not an appropriate description.

Copy link
Author

Choose a reason for hiding this comment

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

As above. This was not intended to be pulled to the base repo

<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net471" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net471" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Downgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants