Skip to content

Commit 456beab

Browse files
Fixes starting proxy with -e. Closes #1482 (#1483)
1 parent 6fe0867 commit 456beab

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

DevProxy/Program.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
using DevProxy.Commands;
77
using System.Net;
88

9-
static WebApplication BuildApplication(string[] args, DevProxyConfigOptions options)
9+
static WebApplication BuildApplication(DevProxyConfigOptions options)
1010
{
11-
var builder = WebApplication.CreateBuilder(args);
11+
// Don't pass command-line args to WebApplication.CreateBuilder because:
12+
// 1. Dev Proxy uses System.CommandLine for CLI parsing, not ASP.NET Core's CommandLineConfigurationProvider
13+
// 2. ConfigureDevProxyConfig clears all configuration sources anyway and only uses JSON config files
14+
var builder = WebApplication.CreateBuilder();
1215

1316
_ = builder.Configuration.ConfigureDevProxyConfig(options);
1417
_ = builder.Logging.ConfigureDevProxyLogging(builder.Configuration, options);
@@ -36,7 +39,7 @@ static WebApplication BuildApplication(string[] args, DevProxyConfigOptions opti
3639

3740
var options = new DevProxyConfigOptions();
3841
options.ParseOptions(args);
39-
var app = BuildApplication(args, options);
42+
var app = BuildApplication(options);
4043

4144
var devProxyCommand = app.Services.GetRequiredService<DevProxyCommand>();
4245
var loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();

0 commit comments

Comments
 (0)