-
Notifications
You must be signed in to change notification settings - Fork 15
Update UserAgent to use AssemblyFileVersion #238
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
base: main
Are you sure you want to change the base?
Conversation
Changed version retrieval in UserAgent property from Assembly.GetExecutingAssembly().GetName().Version to ThisAssembly.AssemblyFileVersion for improved accuracy.
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.
Pull request overview
This pull request updates the version retrieval mechanism for the UserAgent property in the App class. The change replaces the reflection-based approach (Assembly.GetExecutingAssembly().GetName().Version?.ToString()) with a compile-time constant from Nerdbank.GitVersioning (ThisAssembly.AssemblyFileVersion).
Key Changes:
- Simplified version retrieval by using
ThisAssembly.AssemblyFileVersioninstead of runtime reflection - Leverages the Nerdbank.GitVersioning package already configured in the project
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| var version = Assembly.GetExecutingAssembly().GetName().Version?.ToString(); | ||
| var version = ThisAssembly.AssemblyFileVersion; | ||
| version ??= "0.0.0"; |
Copilot
AI
Dec 11, 2025
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.
The null-coalescing assignment on line 50 is now dead code. ThisAssembly.AssemblyFileVersion returns a non-nullable string (generated by Nerdbank.GitVersioning), so the fallback to "0.0.0" will never execute. Consider either removing the null check or directly assigning the value without it.
| version ??= "0.0.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.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changed version retrieval in UserAgent property from Assembly.GetExecutingAssembly().GetName().Version to ThisAssembly.AssemblyFileVersion for improved accuracy.
This pull request makes a minor update to how the application version is determined for the
UserAgentstring. The code now usesThisAssembly.AssemblyFileVersioninstead of the executing assembly's version, which provides a more accurate and consistent version number.(Libraries/Microsoft.Teams.Apps/App.csL49-R49)