Open huan086 opened 7 years ago
Hi huan086,
you PR looks very good. One problem I see is the requirement for .net 4.6.1 since this would break the usage of the tracker for many people using .Net 4.5. Is there any reason why you upgraded to 4.6.1? I think async support was introduced in .Net 4.5..
Making the HttpClient
as a constructor parameter is a good idea for people who are using the HttpClient
as singleton in their application, would it be possible to make it as a optional parameter?
Best regards, Peter
For the .NET 4.6.1, I re-read the deprecation notice for .NET 4.5 and realized I had a misunderstanding. Misunderstand that we shouldn't target .NET 4.5. But the advice was to upgrade the installed framework. Changing the target now.
Could you elaborate why we shouldn't target .NET 4.5? And why should we update the .NET version?
I don't have much knowledge of the .NET eco system, I am trying to catch-up with you guys. If you have a link to an article with must know facts, please share it here.
Also, is there a way to know how many users won't be able to use the library any more if we update the version? Is there some public per version usage percentages so we can base the decision on some more or less concrete facts?
Changed to target .NET 4.5. Added constructor without HttpClient parameter.
Thanks for this PR.
I have to take some time to understand the implication of updating the .NET version.
If you have some helpful resources, do share.
Probably see this? https://en.wikipedia.org/wiki/.NET_Framework#Release_history
If anyone is building desktop app, the installer for the app can skip installing .NET Framework 4.5 when on Windows 8 and above. When installing in Windows 7, installation would be longer.
Let's ignore Vista and previous version since they are no longer supported by MS
We will release v3 before merging this PR.
This will allow users that may be stuck with .NET v4.0 on the production server to benefit from the recent bug fixes and the deprecation of the GPL license.
Since this is a breaking change, it would be ideal if #25 (another breaking change) could be addressed before v4 RTM. However, I have no experience in UWP and .NET Standard. Hopefully someone experienced would help
I realized I haven't added CancelationToken prameter to the async methods. Drawback of that is that the caller won't be able to cancel the async task, i.e. abort the HttpClient.SendAsync before it's complete. Will probably do another pull request on top of this
Thank you for taking the time to educate me on the async support in .NET
I will perform a last review next week and merge your PR.
It would indeed be good to have the possibility to cancel the task. I don't know how much effort it would require though.
Concerning v4, I feel it's OK to release it with only the async support. This is except if the API changes introduced for UWP would require a developer two substantially modify the code when going from v4 to v5.
Thank you
I have created https://github.com/piwik/piwik-dotnet-tracker/issues/66 which I will address to ease the process of refactoring sample code.
Any updates about this PR? I think updating the framework is very important to get the security updates. In addition to, .NET 4.6.1 is compatible with .NET Standard projects. The current version shows the following warning in Visual Studio
[Warning][NU1701] Package 'Piwik.Tracker 3.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Upgrade to .NET 4.6.1. Fixes #34. Use HttpClient for requests. Change all tracking methods to async. Fixes #39.
Warning: this pull request removes all the sync methods