-
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
Timeline - missing 'AddedToProject', 'RemovedFromProject' and more events #1594
Comments
What about making The type could also have an implicit conversion to |
And RemovedFromProject event -- dotnet/roslyn issue 35, after local fix to address AddedToProject ... I like your idea to not hardcoding all events, make the list more resilient ... but of course I know near 0 about Octokit.net design ;) |
Yeah, #1591 should fix these. But given how often new events are introduced I really think deserializing to |
Thanks for the link to the PR. I just hit 'MovedColumnsInProject' ... I will grab the list from the PR ;) |
We had a sort of proof of concept of a way to handle this in #1504 which essentially would see all response enums contain an extra member (eg |
Had to run out for lunch, but I may or may not have a PR brewing, using something like [DebuggerDisplay("{DebuggerDisplay,nq}")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
public struct StringEnum<TEnum> : IEquatable<StringEnum<TEnum>>
where TEnum : struct
{
private readonly string _value;
private TEnum? _parsedValue;
public StringEnum(TEnum parsedValue)
: this(parsedValue.ToString())
{
_parsedValue = parsedValue;
}
public StringEnum(string value)
{
_value = value;
_parsedValue = null;
}
public string Value
{
get { return _value; }
}
public TEnum ParsedValue
{
get { return _parsedValue ?? (_parsedValue = ParseValue()).Value; }
}
internal string DebuggerDisplay
{
get { return Value; }
}
public bool TryParse(out TEnum value)
{
if (string.IsNullOrEmpty(Value))
{
value = default(TEnum);
return false;
}
return Enum.TryParse(Value, ignoreCase: true, result: out value);
}
public bool Equals(StringEnum<TEnum> other)
{
return string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is StringEnum<TEnum> && Equals((StringEnum<TEnum>) obj);
}
public override int GetHashCode()
{
return Value != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(Value) : 0;
}
public static bool operator ==(StringEnum<TEnum> left, StringEnum<TEnum> right)
{
return left.Equals(right);
}
public static bool operator !=(StringEnum<TEnum> left, StringEnum<TEnum> right)
{
return !left.Equals(right);
}
public static implicit operator StringEnum<TEnum>(string value)
{
return new StringEnum<TEnum>(value);
}
public static implicit operator StringEnum<TEnum>(TEnum parsedValue)
{
return new StringEnum<TEnum>(parsedValue);
}
public override string ToString()
{
return Value ?? "null";
}
private TEnum ParseValue()
{
TEnum value;
if (TryParse(out value))
{
return value;
}
throw new ArgumentException(string.Format(
CultureInfo.InvariantCulture,
"Value '{0}' is not a valid '{1}' enum value.",
ToString(),
typeof(TEnum).Name));
}
} It's basically a drop-in replacement of the existing enum, with no additional code changes necessary because of the implicit conversion. |
Even better 👍 |
Great, thanks! Out of curiosity: What is cadence for your NuGet alpha releases? Last nuget.org alpha build is from January. I'd like to know when I can stop using the project-to-project reference. Not a high pri ... but would be nice. If there is anything I can help with to release new alpha version, please let me know. If it is not over my head or super-costly, I will be happy to help. |
So we don't currently regularly release alpha packages to nuget... that one release was actually a special case to expose our dotnetcore port to a wider audience You can add the appveyor CI feed to your nuget settings and pull packages from there if you need My plan is once we've merged the dotnetcore and CAKE build script (should be soon) we'll look at automating pre release packages pushed to nuget on each PR merged to master |
ok, I'll use the AppVeyor CI feed (I think I already added it anyway, then I realized it is not fixed either there yet ;-) - I just forgot about it ...) |
Looks like variant of #1563 - which doesn't seem to be fixed by looking at source code: https://github.com/octokit/octokit.net/blob/master/Octokit/Models/Response/EventInfo.cs#L74
Got it for dotnet/roslyn issues (numbers: 3 and 5).
I tried 0.24.1-alpha NuGet, which doesn't have even #1563 fix (I hit also LineCommented and CommitCommented). Will try latest master build later ...
The text was updated successfully, but these errors were encountered: