Description
Starting Dev Proxy with EntraMockResponsePlugin enabled fails immediately with a DI resolution error on all versions from v2.0.0 onwards (tested v2.0.0, v2.2.0, v2.3.0). The same configuration works correctly on v1.3.0.
Expected behaviour
Dev Proxy starts and intercepts requests to login.microsoftonline.com, returning mock token responses.
Actual behaviour
Immediate crash:
fail An error occurred while running Dev Proxy
Exception Details: System.InvalidOperationException: Unable to resolve service for type
'System.Security.Cryptography.X509Certificates.X509Certificate2'
while attempting to activate 'DevProxy.Plugins.Mocking.EntraMockResponsePlugin'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(...)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(...)
...
Steps to reproduce
-
Install Dev Proxy v2.3.0 (or any v2.x):
winget install DevProxy.DevProxy --version 2.3.0 --force
-
Create devproxyrc.json:
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.3.0/rc.schema.json",
"plugins": [
{
"name": "EntraMockResponsePlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "entraMocks"
}
],
"urlsToWatch": [
"https://login.microsoftonline.com/*"
],
"entraMocks": {
"mocksFile": "entra-mocks.json"
}
}
-
Create entra-mocks.json:
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.3.0/mockresponseplugin.mocksfile.schema.json",
"mocks": [
{
"request": {
"url": "https://login.microsoftonline.com/*/oauth2/v2.0/token",
"method": "POST"
},
"response": {
"statusCode": 200,
"body": {
"token_type": "Bearer",
"expires_in": 3600,
"access_token": "mock-access-token"
},
"headers": [
{ "name": "Content-Type", "value": "application/json" }
]
}
}
]
}
-
Run:
devproxy --config-file devproxyrc.json
Dev Proxy Version
2.3.0
Operating system (environment)
Windows
Shell
PowerShell
Configuration file
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.3.0/rc.schema.json",
"asSystemProxy": false,
"validateSchemas": false,
"port": 8001,
"apiPort": 9500,
"plugins": [
{
"name": "EntraMockResponsePlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "entraMocksPlugin"
}
],
"urlsToWatch": [
"https://login.microsoftonline.com/*"
],
"entraMocksPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.3.0/mockresponseplugin.schema.json",
"mocksFile": "entra-mocks.json"
},
"logLevel": "information",
"showSkipMessages": true,
"showTimestamps": true
}
Additional Info
No response
Description
Starting Dev Proxy with
EntraMockResponsePluginenabled fails immediately with a DI resolution error on all versions from v2.0.0 onwards (tested v2.0.0, v2.2.0, v2.3.0). The same configuration works correctly on v1.3.0.Expected behaviour
Dev Proxy starts and intercepts requests to
login.microsoftonline.com, returning mock token responses.Actual behaviour
Immediate crash:
Steps to reproduce
Install Dev Proxy v2.3.0 (or any v2.x):
Create
devproxyrc.json:{ "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.3.0/rc.schema.json", "plugins": [ { "name": "EntraMockResponsePlugin", "enabled": true, "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", "configSection": "entraMocks" } ], "urlsToWatch": [ "https://login.microsoftonline.com/*" ], "entraMocks": { "mocksFile": "entra-mocks.json" } }Create
entra-mocks.json:{ "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.3.0/mockresponseplugin.mocksfile.schema.json", "mocks": [ { "request": { "url": "https://login.microsoftonline.com/*/oauth2/v2.0/token", "method": "POST" }, "response": { "statusCode": 200, "body": { "token_type": "Bearer", "expires_in": 3600, "access_token": "mock-access-token" }, "headers": [ { "name": "Content-Type", "value": "application/json" } ] } } ] }Run:
Dev Proxy Version
2.3.0
Operating system (environment)
Windows
Shell
PowerShell
Configuration file
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.3.0/rc.schema.json",
"asSystemProxy": false,
"validateSchemas": false,
"port": 8001,
"apiPort": 9500,
"plugins": [
{
"name": "EntraMockResponsePlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "entraMocksPlugin"
}
],
"urlsToWatch": [
"https://login.microsoftonline.com/*"
],
"entraMocksPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.3.0/mockresponseplugin.schema.json",
"mocksFile": "entra-mocks.json"
},
"logLevel": "information",
"showSkipMessages": true,
"showTimestamps": true
}
Additional Info
No response