public static async Task Main()

in src/ApiPort/ApiPort/Program.cs [17:111]


        public static async Task<int> Main(string[] args)
        {
            var productInformation = new ProductInformation("ApiPort_Console");

            Console.WriteLine(LocalizedStrings.Header, LocalizedStrings.ApplicationName, productInformation.InformationalVersion, DocumentationLinks.About, DocumentationLinks.PrivacyPolicy);

            var options = CommandLineOptions.ParseCommandLineOptions(args);

            if (options.Command == AppCommand.Exit)
            {
                return -1;
            }

            Console.WriteLine();

            using (var container = DependencyBuilder.Build(options, productInformation))
            {
                var progressReport = container.Resolve<IProgressReporter>();

                try
                {
                    var client = container.Resolve<ConsoleApiPort>();

                    switch (options.Command)
                    {
                        case AppCommand.ListTargets:
                            await client.ListTargetsAsync();
                            break;
                        case AppCommand.AnalyzeAssemblies:
                        case AppCommand.DumpAnalysis:
                            await client.AnalyzeAssembliesAsync();
                            break;
                        case AppCommand.DocIdSearch:
                            await client.RunDocIdSearchAsync();
                            break;
                        case AppCommand.ListOutputFormats:
                            await client.ListOutputFormatsAsync();
                            break;
                    }

                    return 0;
                }
                catch (Autofac.Core.DependencyResolutionException ex) when (GetPortabilityException(ex) is PortabilityAnalyzerException p)
                {
                    Trace.TraceError(ex.ToString());

                    WriteException(p);
                }
                catch (PortabilityAnalyzerException ex)
                {
                    WriteException(ex);
                }
                catch (ProxyAuthenticationRequiredException ex)
                {
                    WriteException(ex);
                }
                catch (AggregateException ex)
                {
                    Trace.TraceError(ex.ToString());

                    // If the exception is known, display the message as it has already been localized
                    if (GetRecursiveInnerExceptions(ex).Any(x => x is PortabilityAnalyzerException))
                    {
                        foreach (PortabilityAnalyzerException portEx in GetRecursiveInnerExceptions(ex).Where(x => x is PortabilityAnalyzerException))
                        {
                            WriteException(portEx);
                        }
                    }
                    else if (!IsWebSecurityFailureOnMono(ex))
                    {
                        WriteError(LocalizedStrings.UnknownException);
                    }
                }
                catch (Exception ex)
                {
                    Trace.TraceError(ex.ToString());

                    WriteError(LocalizedStrings.UnknownException);
                }
                finally
                {
                    if (progressReport != null)
                    {
                        Console.WriteLine();

                        foreach (var issue in progressReport.Issues)
                        {
                            WriteWarning("* " + issue);
                        }
                    }
                }

                return -1;
            }
        }