Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* add .NET 5.0 support #286

Merged
merged 1 commit into from
May 6, 2021
Merged

* add .NET 5.0 support #286

merged 1 commit into from
May 6, 2021

Conversation

trivalik
Copy link

@trivalik trivalik commented May 1, 2021

Add support for .NET 5, except for the UWP project.

Copy link
Owner

@codebude codebude left a comment

Choose a reason for hiding this comment

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

Thanks for your effort and all the changes. In general I'm already open for changes that make QRCoder future-proof. Nevertheless, due to the huge userbase I want to ensure that every change is not (or minimal) harmful for existing users. I don't want to early adopt at any price. Thus, before merging your changes, I like to clarify some points on your changes. Can you check my review comments?

QRCoder/PayloadGenerator.cs Show resolved Hide resolved
@@ -1552,7 +1557,7 @@ public override string ToString()
bezahlCodePayload += $"creditorid={ Uri.EscapeDataString(creditorId)}&";
if (!string.IsNullOrEmpty(mandateId))
bezahlCodePayload += $"mandateid={ Uri.EscapeDataString(mandateId)}&";
if (dateOfSignature != null)
if (dateOfSignature != DateTime.MinValue)
Copy link
Owner

Choose a reason for hiding this comment

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

The contructor takes nullable DateTimes ([...] , DateTime? dateOfSignature = null, [...] so I guess the dates should be checked against null or does ... != Datetime.MinValue also check for null?

Copy link
Author

@trivalik trivalik May 3, 2021

Choose a reason for hiding this comment

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

DateTime is a struct. It cannot be null. Also a warning appeared for this after add of .NET 5. I didn't check datatype of dateOfSignature. Nullable is not null, it is a class arround. So we have to check it by: dateOfSignature.HasValue
I will take care.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for the feedback. The documentation states that for nullable types both, checking for null and checking for "HasValue" works: https://docs.microsoft.com/de-de/dotnet/csharp/language-reference/builtin-types/nullable-value-types
(Check second and third example.)

So I suggest we change the code to:

Suggested change
if (dateOfSignature != DateTime.MinValue)
if (dateOfSignature.HasValue && dateOfSignature >= DateTime.MinValue)

Copy link
Author

Choose a reason for hiding this comment

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

I guess we have another issue here. The constructor does already convert the Nullable type to a regulare DateTime. In this case, nothing is assign and it will be the default value, which is probably DateTime.MinValue. This means there is no relation between your comment and this compare.

Copy link
Owner

@codebude codebude May 4, 2021

Choose a reason for hiding this comment

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

The constructor does already convert the Nullable type to a regulare DateTime.

But it does so, only if dateOfSignature != null otherwise the conversion isn't run.

if (authority == AuthorityType.periodicsinglepayment || authority == AuthorityType.periodicsinglepaymentsepa)
{
bezahlCodePayload += $"periodictimeunit={periodicTimeunit}&";
bezahlCodePayload += $"periodictimeunitrotation={periodicTimeunitRotation}&";
if (periodicFirstExecutionDate != null)
if (periodicFirstExecutionDate != DateTime.MinValue)
Copy link
Owner

Choose a reason for hiding this comment

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

The contructor takes nullable DateTimes ([...] , DateTime? periodicFirstExecutionDate = null, [...] so I guess the dates should be checked against null or does ... != Datetime.MinValue also check for null?

Copy link
Author

Choose a reason for hiding this comment

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

DateTime is a struct. It cannot be null. Also a warning appeared for this after add of .NET 5. I didn't check datatype of dateOfSignature. Nullable is not null, it is a class arround. So we have to check it by: dateOfSignature.HasValue
I will take care.

bezahlCodePayload += $"periodicfirstexecutiondate={periodicFirstExecutionDate.ToString("ddMMyyyy")}&";
if (periodicLastExecutionDate != null)
if (periodicLastExecutionDate != DateTime.MinValue)
Copy link
Owner

Choose a reason for hiding this comment

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

The contructor takes nullable DateTimes ([...] , DateTime? periodicLastExecutionDate = null, [...] so I guess the dates should be checked against null or does ... != Datetime.MinValue also check for null?

Copy link
Author

Choose a reason for hiding this comment

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

DateTime is a struct. It cannot be null. Also a warning appeared for this after add of .NET 5. I didn't check datatype of dateOfSignature. Nullable is not null, it is a class arround. So we have to check it by: dateOfSignature.HasValue
I will take care.

QRCoder/QRCoder.csproj Outdated Show resolved Hide resolved
QRCoder/QRCoder.csproj Show resolved Hide resolved
QRCoderConsole/Properties/AssemblyInfo.cs Outdated Show resolved Hide resolved
QRCoderConsole/QRCoderConsole.csproj Outdated Show resolved Hide resolved
QRCoderDemo/Properties/AssemblyInfo.cs Outdated Show resolved Hide resolved
QRCoderTests/QRCoderTests.csproj Outdated Show resolved Hide resolved
@trivalik
Copy link
Author

trivalik commented May 3, 2021

After review I found that QRCoder.csproj specifies the version in new style, but disable it use by <GenerateAssemblyInfo>false</GenerateAssemblyInfo>.

@trivalik
Copy link
Author

trivalik commented May 3, 2021

My final change is now up.

@codebude
Copy link
Owner

codebude commented May 4, 2021

Hi @trivalik I reviewed the changes again. The only thing unsolved, we should handle before merging, is the DateTime/DateTime? part. Either your changes (... != MinValue) should be rolled back or we should add some kind of null/HasValue check,

@trivalik
Copy link
Author

trivalik commented May 4, 2021

As I wrote above, your constructor does assign for the null value of DateTime? nothing to the local member with type DateTime. This lead to that only the default value is assigned, this is DateTime.MinValue or if you want default(DateTime).

@codebude codebude merged commit 299f023 into codebude:master May 6, 2021
@codebude
Copy link
Owner

codebude commented May 6, 2021

Hi @trivalik ,

the merge went well. I just had to fix one, two things in the QRCoderTests project. But unfortunately another problem arised. For builds and Nuget publishing I use the services of MyGet (https://www.myget.org/). (Everytime a commit runs into this Github repo, a build is done at MyGet. Thus we have a package stream for all the "nightly" builds.) Unfortunately Myget doesn't support the target "net5.0-windows" by now. So I thought about removing "net5.0-windows" as target for the moment (while keeping net5.0).

Am I correct that the only thing (which isn't handled by net5.0) we would loose is the support of XamlQRCode for net5.0 users?

@trivalik
Copy link
Author

trivalik commented May 6, 2021

Yes. WPF XAML is Windows only. Maybe some nuget packages could cover it, but here I am not the expert.

@codebude
Copy link
Owner

codebude commented May 6, 2021

Thanks for your feedback. I'll check in parallel if moving the automatic builds from MyGet to Github Actions/Runners is possible. If I can figure out how this works (especially for my multi target builds), we can keep the net5.0-windows builds :-)

@martingra
Copy link

Is the 1.4.2 version including the support for .NET 5.0 going to be published as a NuGet package in the short term?

@codebude
Copy link
Owner

@martingra 1.4.2 will include .NET 5.0 support. Release on Nuget is planned during the next 14 days.

@martingra
Copy link

@martingra 1.4.2 will include .NET 5.0 support. Release on Nuget is planned during the next 14 days.

Hi! Is there a new date planned to deploy 1.4.2 on Nuget?

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.

3 participants