-
Notifications
You must be signed in to change notification settings - Fork 47
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
Feat/improve exceptions #164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, few things to change
…at/improve-exceptions
…te/iw4y into feat/improve-exceptions
I'm testing this as soon as I have a bit of time |
@@ -132,6 +132,10 @@ namespace Game | |||
extern const dvar_t** cg_scoreboardWidth; | |||
|
|||
extern const dvar_t** version; | |||
/// <summary> |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why so? care to explain? :P
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea but as a result of it being microsoft-specific, this comment is visible in Intellisense when you type the name of the function or variable in Visual Studio.
If you type Game::version it will print in a tooltip the content of the <summary> placed just above, making it convenient to use. I do not have the same behaviour with just ///
(although maybe there are other ways to achieve it)
If you have a practical case where the XML Documentation actually poses a problem, one that I can verify, in comparison to slash code documentation (or other methods) tell me! I do not know one, but I also work predominantly with M$ tooling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
If what you mean by " 👎 " is that Visual Studio doesn't handle XML comments in Intellisense, I can provide examples where it does.
If what you mean by " 👎 " is that you know no practical downsides to using XML documentation then i'm happy to mark this conversation as resolved.
If you meant to express anything else, please use your words, I'm not fluent in "👎 " 😄
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My question is: Is there anything that XML documentation breaks in comparison to ///
? For instance, is there a widely used code editor that simply won't accept or display XML comments but would display ///
comments?
If this is not the case then XML comments are the way to go - a large portion of people who work with this project are using or will use Visual Studio predominantly, where having Intellisense enabled by default means XML comments do have an advantage over ///
comments. But if XML comments breaks other widely used IDEs, I don't mind considering leaving them out of the codebase.
I'm looking for a practical example of XML docs presenting a problem, in a real environment - i understand the theory behind having things standard or not but it's just not something that strikes me as particularly important in that project or in that ecosystem, so practical cases where something actually breaks take priority.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the XML style comments on purpose for a couple of reasons:
-
As mentioned by louve, one just needs to type
///
and it will automatically create the<summary>
tag and others for return types and parameters etc. -
Being able to distinguish them from other comments might come in handy in the future (perhaps the wiki will get a section explaining the codebase, and XML comments would make it easy for automated export and formatting).
-
I am aware that this is a Visual Studio specific feature, but on the other hand most people will be working on the project with this IDE anyway and will therefore benefit from it, while users of other IDEs will not have much of a disadvantage. Moreover, the XML style is just the default option in Visual Studio, there are other, more standardized options, switching to another that works for everyone would be no problem:
-
Having an eye-catching doc style will hopefully remind and encourage others to document their code too :D
const auto serverVersion = Dvar::Var("sv_version").get<std::string>(); | ||
const auto ipAddress = Network::Address(*Game::connectedHost).getString(); | ||
|
||
char serverName[256]{ 0 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-constant bound is dangerous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to accompany your comment with a snippet or a suggestion for something that the offending code should be replaced with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None that come to mind right now without more context. I believe the first step would be to look into StripColors and StripAllTextIcons and see how we can handle it better; perhaps leave a TODO for now or a FIXME;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened issue #165 for this.
What does this PR do?
This pull request improves the message shown when the game crashes.
It replaces the old MessageBox with a TaskDialog that offers more customisation options.
The following information is included in the new message:
And if the crash happened in-game:
It also includes a hyperlink to join the Discord server.
Anything else we should know?
To make this possible, a few other things were added or changed too.
sv_version
dvar, which contains the version parsed from an Infostringshortversion
dvar, which contains the client version (was already part of the game)UI_GetGameTypeDisplayName
method, for completeness, not really requiredScreenshot of crash messages
Crash happened when playing on a dedicated server
Crash happened when playing a private match
Crash happened somewhere at the main menu