-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
NullReferenceException when Repository.GetAllTeams() contains nested teams #2052
Comments
@MikhailTymchukDX just a heads up that those screenshots contain the token you used. Please ensure it gets revoked or renewed before someone decides to borrow it. |
@shiftkey oops, my bad. revoked it. thanks a ton! |
I presume there isn't an update for this? We started getting bit by this in the last few days. |
I've simply commented out the parent field in the Team object for testing and the null exception went away. I have to stop for now. I suspect it's related to the parent team having (null) for the permission field but wasn't able to confirm yet. |
Okay so this definitely seems related to attempting to set a StringEnum to null. Line 1495 in SimpleJson.cs stopped in the debugger is showing that it's deserializes the null value as.. null, and is attempting to use the compiled setter to set the value on line 2074. The compiled setter doesn't handle that case for the StringEnum apparently. So the next question is what is it supposed to do with a null value for a StringEnum? Can I add a value to a StringEnum to have it handle null properly? |
As a temporary workaround I've added this to line 193 of SimpleJsonSerializer.cs: // HACK: Support for string enums with null values
if (value == null && ReflectionUtils.IsStringEnumWrapper(type))
{
return Activator.CreateInstance(type, "null");
} And this to the Permission.cs enum: /// <summary>
/// Team groups can be null, such as when a parent team doesn't have permission
/// to a repo while a child team does.
/// </summary>
[Parameter(Value = "null")]
None, This feels pretty hacky but I don't really have a better solution at the moment. I'd say it sounds like an API bug on GitHub's end but it doesn't, as lack of permissions to a repository feels alright to be a 'null' value coming from the API. |
@cliffchapmanrbx apologies for missing your messages. It might be that we only need to make that change in I've opened #2156 which will make a beta package available to help with your testing, as I need to be a member of your organization to query for teams in the way that you are. |
Octokit.NET v0.36.0
throws an exception:
Inner exception stack trace:
FIddler output:
If I move ASPxGridView to the root, the error is gone:
The text was updated successfully, but these errors were encountered: