Crash when calling SchedulerStoreSvc.GetClientVersion() in some scenarios
- Dominant language
- PowerShell
- Stars
- 34
- Forks
- 19
- Avg merge
- 41m
- Merged PRs (30d)
- 4
Description
#### Problem Description
In some scenarios, for example when publishing as `PublishSingleFile` a call to `StoreServer.RegisterWithServer()` can throw an exception:
```
---> System.ArgumentException: The path is empty. (Parameter 'path')
at System.IO.Path.GetFullPath(String path)
at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at Microsoft.Hpc.Scheduler.Store.SchedulerStoreSvc.GetClientVersion()
at Microsoft.Hpc.Scheduler.Store.SchedulerStoreSvc..cctor()
--- End of inner exception stack trace ---
at Microsoft.Hpc.Scheduler.Store.SchedulerStoreSvc.get_ClientVersion()
at Microsoft.Hpc.Scheduler.Store.StoreServer.RegisterWithServer()
at Microsoft.Hpc.Scheduler.Store.StoreServer.RegisterEvent(String schedulerNode)
at Microsoft.Hpc.Scheduler.Store.StoreServer.ConnectWcfAsync(CancellationToken token)
at Microsoft.Hpc.Scheduler.Store.StoreServer.InternalConnectAsync(CancellationToken token, ConnectMethod method)
at Microsoft.Hpc.Scheduler.Store.StoreServer.ConnectAsync(StoreConnectionContext context, CancellationToken token, ConnectMethod method)
at Microsoft.Hpc.Scheduler.Store.SchedulerStoreSvc.InitializeAsync(CancellationToken token, ConnectMethod method)
at Microsoft.Hpc.Scheduler.Store.SchedulerStoreSvc.RemoteConnectAsync(StoreConnectionContext context, CancellationToken token, ConnectMethod method)
at Microsoft.Hpc.Scheduler.Store.SchedulerStore.ConnectAsync(StoreConnectionContext context, CancellationToken token, ConnectMethod method)
at Microsoft.Hpc.Scheduler.Scheduler.ConnectAsync(SchedulerConnectionContext context, CancellationToken token, ConnectMethod method)
```
The problem is that `SchedulerStoreSvc.GetClientVersion()` call `Assembly.GetExecutingAssembly().Location` that can return an empty string.
It can easily be fixed using a different approach:
```csharp
//Crash because [.Location] is an empty string
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
//Works even when published as PublishSingleFile
var versionInfo = Assembly.GetExecutingAssembly().GetName().Version;
```
#### Steps to Reproduce
Publish an application as `PublishSingleFile` and try to connet to any server.
#### Expected Results
Connection successfull
#### Actual Results
Crash
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.