Skip to content

Service fails for any download exception  #814

@cristianbojor

Description

@cristianbojor

Hello,

First, thank you for the great project!

It seems that for any download exception (from not available), an aggregate exception is thrown, even if failOnError is false:

2021-03-26T09:11:22.478 ERROR service - Failed to download https://some-server/runner.bat to C:\Program Files (x86)\someprogram\program\runner2.bat
System.AggregateException: One or more errors occurred. ---> System.Net.WebException: The remote name could not be resolved: 'some-server'
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at WinSW.Download.<PerformAsync>d__16.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.Net.WebException: The remote name could not be resolved: 'preprodupdate-preprod.smartcheck.solutions'
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at WinSW.Download.<PerformAsync>d__16.MoveNext()<---

2021-03-26T09:11:22.484 ERROR service - Failed to start service.
System.AggregateException: One or more errors occurred.
   at WinSW.WrapperService.DoStart()
   at WinSW.WrapperService.OnStart(String[] args)

I think the problem is at this line:

throw new AggregateException(exceptions);

Maybe the exception should be thrown only if exceptions is empty.

Environment

WinSW version: 2.11.0 and WinSW v3.0.0-alpha.8
WinSW package type: .NET 4.6.1
Windows version: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions