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

#34 nullable c# 8 #39

Merged
merged 2 commits into from
Aug 10, 2020
Merged

Conversation

SimonGeering
Copy link
Member

Closes #34
Please note this is an initial "surgery with a chainsaw" change to get nullable reference types in place with all the code still compiling and the tests working.

While I'm certain some of the chosen defaults could be improved, and there should probably be some unit tests added to drive out such scenarios, the intent here is to have this feature enabled sooner rather than later so that the problem doesn't grow worse in the meantime.

public static ConnectionCredentials ToTwitchLib(this TwitchCredentials credentials, IDataProtection dataProtection)
{
if (credentials.AuthToken == null)
throw new System.ArgumentException("Unable to convert null AuthToken", nameof(credentials));
Copy link
Member Author

Choose a reason for hiding this comment

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

Assumed an exception was better here than just letting the decrypt blow up on an empty byte[]

Copy link
Member

Choose a reason for hiding this comment

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

Agreed.

@@ -45,25 +45,25 @@ public void Disconnect()
throw new NotImplementedException();
}

protected virtual void Client_OnLog(object sender, OnLogArgs e)
protected virtual void Client_OnLog(object? sender, OnLogArgs e)
Copy link
Member Author

Choose a reason for hiding this comment

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

All these sender args need to be nullable since twitchlib is not c#8

Copy link
Member

Choose a reason for hiding this comment

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

*yet

I'll ping LuckyNoS7evin to see if his restructure is going to change that.

Copy link
Member Author

@SimonGeering SimonGeering left a comment

Choose a reason for hiding this comment

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

Some additional notes inline

Copy link
Member

@benrick benrick left a comment

Choose a reason for hiding this comment

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

👍 It's a solid first pass to get nullable reference feature enabled.

public static ConnectionCredentials ToTwitchLib(this TwitchCredentials credentials, IDataProtection dataProtection)
{
if (credentials.AuthToken == null)
throw new System.ArgumentException("Unable to convert null AuthToken", nameof(credentials));
Copy link
Member

Choose a reason for hiding this comment

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

Agreed.

@@ -45,25 +45,25 @@ public void Disconnect()
throw new NotImplementedException();
}

protected virtual void Client_OnLog(object sender, OnLogArgs e)
protected virtual void Client_OnLog(object? sender, OnLogArgs e)
Copy link
Member

Choose a reason for hiding this comment

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

*yet

I'll ping LuckyNoS7evin to see if his restructure is going to change that.

@benrick benrick merged commit 3c453e3 into DevChatter:dev Aug 10, 2020
@SimonGeering SimonGeering deleted the #34-NullableCSharp8 branch August 10, 2020 14:46
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.

Switch to c# 8 with nullable reference types
2 participants