Simplify accessing assembly versions#257
Conversation
Use the same method everywhere an assembly version is required in order not to use`FileVersionInfo.GetVersionInfo` directly, which is not compatible with single file applications whose assembly.Location always return an empty string. (It was still used directly in the `AuthProcessor` class) Also, use GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version with a question mark before acessing the `.Version` property in order to fallback to version on disk rather than crashing with a null reference exception. (The ? was missing in both Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.SdkVersionProperty and Microsoft.PowerPlatform.Dataverse.Client.Auth.TokenCache.FileBackedTokenCacheHints.FileBackedTokenCacheHints)
|
Thanks again for your contribution :) We will look into and review this. |
|
We have reviewed this one and are not going accept this one. We will consider doing some refactoring of where the versions come from now that we have included parts of the server in this client, however there are several versions we care about from different libs in the client, and we use them for a few different things. Thanks for calling it out though. |
|
I think this pull request did not change the current behaviour, it only reduced code duplication. But I may be wrong, it's hard to test all the affected code paths. Anyway, could you please at least fix the FileVersionInfo.GetVersionInfo(typeof(Xrm.Sdk.Organization.OrganizationDetail).Assembly.Location).FileVersion;This is preventing single-file deployment because |
|
Yep, we will fix that, there are several place we need to move away from file versions. |
|
We have updated this. see fix #272 |
Use the same method everywhere an assembly version is required in order not to use
FileVersionInfo.GetVersionInfodirectly, which is not compatible with single file applications whose assembly.Location always return an empty string. (It was still used directly in theAuthProcessorclass)Also, use GetCustomAttribute()?.Version with a question mark before acessing the
.Versionproperty in order to fallback to version on disk rather than crashing with a null reference exception. (The ? was missing in both Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.SdkVersionProperty and Microsoft.PowerPlatform.Dataverse.Client.Auth.TokenCache.FileBackedTokenCacheHints.FileBackedTokenCacheHints)