ローカルデバッグガイド — C#
This guide covers everything specific to debugging an Extend Service Extension app written in C#. For general debugging concepts — environment setup, VS Code debug workflow, log reading, and common issues — see:
- Extend local debugging guide — common concepts for all Extend app types
- C# language setup guide — .NET prerequisites, attach mode, jq, and C#-specific troubleshooting
Project structure
src/
└── AccelByte.Extend.ServiceExtension.Server/
├── AccelByte.Extend.ServiceExtension.Server.csproj
├── Program.cs # Entry point
├── Classes/
│ ├── AuthorizationInterceptor.cs # IAM token and permission validation
│ └── ...
├── Protos/
│ ├── service.proto # gRPC API definition
│ └── ...
└── Services/
└── MyService.cs # Your business logic
| File | What it does |
|---|---|
Program.cs | Entry point — wires gRPC server, gRPC-Gateway, metrics, and auth. |
Services/MyService.cs | Your business logic — implements the gRPC service methods. |
Classes/AuthorizationInterceptor.cs | Validates every incoming request's IAM token and permission. |
Protos/service.proto | Defines the gRPC API — endpoints, request/response shapes, and required permissions. |
Port numbers:
| Port | Purpose |
|---|---|
6565 | gRPC server (internal — used by gRPC-Gateway) |
8000 | gRPC-Gateway HTTP/REST — call this from a browser, Postman, or curl |
8080 | Prometheus metrics endpoint (/metrics) |
Running the service locally
From the terminal
# Export all variables from your .env file
export $(grep -v '^#' .env | xargs)
dotnet run --project src/AccelByte.Extend.ServiceExtension.Server
From VS Code
Use Terminal → Run Task → "Run: Service".
This task is defined in .vscode/tasks.json and loads the .env file for you automatically.
Confirming the service is up
You should see logs like:
{"time":"...","level":"INFO","msg":"app server started","service":"extend-app-service-extension"}
{"time":"...","level":"INFO","msg":"starting gRPC-Gateway HTTP server","port":8000}
{"time":"...","level":"INFO","msg":"serving prometheus metrics","port":8080,"endpoint":"/metrics"}
Open http://localhost:8000<BASE_PATH>/apidocs/ in your browser to verify Swagger UI is live.
Attaching the debugger
VS Code (recommended)
The repository ships with a ready-to-use launch configuration in .vscode/launch.json:
{
"name": "Debug: Service",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/src/AccelByte.Extend.ServiceExtension.Server/bin/Debug/net8.0/AccelByte.Extend.ServiceExtension.Server.dll",
"envFile": "${workspaceFolder}/.env",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
}
Follow the attaching the debugger steps in the generic guide, then select "Debug: Service" from the dropdown.
Other IDEs
Start the app with diagnostics enabled, then attach your IDE using "Attach to process":
export $(grep -v '^#' .env | xargs)
DOTNET_EnableDiagnostics=1 dotnet run --project src/AccelByte.Extend.ServiceExtension.Server
Most IDEs (JetBrains Rider, Visual Studio) support attaching to a running .NET process via Run → Attach to process.
Where to put breakpoints
| What you want to investigate | File and location |
|---|---|
| A specific REST endpoint being called | Services/MyService.cs — top of the relevant method |
| Auth/token validation failure | Classes/AuthorizationInterceptor.cs — the Intercept method |
| Data not saving or loading correctly | The storage/repository class used in your service |
| Service not starting at all | Program.cs — the startup initialization block |
For conditional breakpoint syntax, see the C# language guide.
Reading logs
For jq log filtering, see the
C# language guide.
Testing endpoints manually
For curl and grpcurl usage, see
Testing with grpcurl in the generic guide.
For Swagger UI testing (SE-specific), see Testing endpoints manually in the SE main guide.
C#-specific troubleshooting
Proto changes have no effect
Symptom: You edited Protos/service.proto but nothing changed at runtime.
Cause: The generated gRPC stubs have not been rebuilt.
Fix: Run a clean build:
dotnet build src/AccelByte.Extend.ServiceExtension.Server
The .csproj file includes a <Protobuf> item that triggers code generation automatically
on build. If you still see stale behavior, run:
dotnet clean && dotnet build src/AccelByte.Extend.ServiceExtension.Server
DOTNET_ENVIRONMENT and configuration sources
The app may read additional configuration from appsettings.json or environment-specific
variants (appsettings.Development.json). Set DOTNET_ENVIRONMENT=Development in your .env
to activate development-mode configuration.
Checking for port conflicts
See Checking for port conflicts in the C# language guide.
AI assistance
The app template ships with a Claude agent skill at
.claude/skills/debugging-guide/SKILL.md.
For AI prompting tips and MCP server details, see Debugging with AI assistance in the generic guide.