Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'uriString') #3103

Closed
RudyCo opened this issue Dec 11, 2023 · 10 comments
Labels

Comments

@RudyCo
Copy link

RudyCo commented Dec 11, 2023

Output from azd version
azd version 1.5.0 (commit 012ae73)

Describe the bug

[2023-12-11T09:31:59.820Z] Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'uriString')
[2023-12-11T09:31:59.822Z]    at System.Uri..ctor(String uriString)
[2023-12-11T09:31:59.823Z]    at SimpleTodo.Api.Program.<>c__DisplayClass0_0.<Main>b__0(IConfigurationBuilder config) in C:\Users\usr\source\temp\todo-csharp-sql-swa-func\src\api\Program.cs:line 16
[2023-12-11T09:31:59.824Z]    at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass6_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder)
[2023-12-11T09:31:59.825Z]    at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
[2023-12-11T09:31:59.826Z]    at Microsoft.Extensions.Hosting.HostBuilder.Build()
[2023-12-11T09:31:59.827Z]    at SimpleTodo.Api.Program.Main(String[] args) in C:\Users\usr\source\temp\todo-csharp-sql-swa-func\src\api\Program.cs:line 13
[2023-12-11T09:31:59.828Z]    at SimpleTodo.Api.Program.<Main>(String[] args)
[2023-12-11T09:32:01.152Z] Language Worker Process exited. Pid=26460.

To Reproduce
VS Code Command > Run Task > Start API

Expected behavior
API should start normally.

Environment
Information on your environment:
* Language name and version : C#, .NET 8
* IDE and version : Visual Studio Code 1.85.0

Additional context
Template : todo-csharp-sql-swa-func

@vhvb1989
Copy link
Member

@RudyCo , you need to run azd up or azd provision before doing Start API.

The API src-code requires values to be set on the ENV and that happens after azd creates resources on Azure.

There should be a README.md with instructions within the api folder, similar to https://github.com/Azure-Samples/todo-java-mongo/tree/main/src/api#java-with-spring-boot-rest-api. That readme should tell you what ENV VARS are required by the application in case you want to use local resources, instead of Azure.

@RudyCo
Copy link
Author

RudyCo commented Dec 11, 2023

README.md contains a title : Csharp Azure Functions API.

@vhvb1989
Copy link
Member

@RudyCo , yeah, it is missing

@vhvb1989
Copy link
Member

Also, FYI, we are close to merge a change to .net azd-todo-samples to use .NET8 instead of 6.
These are the changes: Azure-Samples/todo-csharp-sql-swa-func@staging...pr/3017

PR: #3017

@vhvb1989
Copy link
Member

Created #3107 to follow up.

@RudyCo
Copy link
Author

RudyCo commented Dec 11, 2023

I confirm that it works fine once deployed to Azure! Thanks a lot.

@RudyCo RudyCo closed this as completed Dec 11, 2023
@RudyCo RudyCo reopened this Dec 11, 2023
@RudyCo
Copy link
Author

RudyCo commented Dec 11, 2023

Locally, if I use the Start Web command, it failed with the following error:

Restoring services (azd restore)

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xac54cd]

goroutine 1 [running]:
github.com/azure/azure-dev/cli/azd/pkg/project.(*ImportManager).ServiceStable(0x0, {0x1251ec0, 0xc0003ea7b0}, 0xc0000e1760)
        github.com/azure/azure-dev/cli/azd/pkg/project/importer.go:55 +0x14d
github.com/azure/azure-dev/cli/azd/pkg/project.(*ImportManager).HasService(0x1?, {0x1251ec0?, 0xc0003ea7b0?}, 0xc000000780?, {0xc00000a0e0, 0x3})
        github.com/azure/azure-dev/cli/azd/pkg/project/importer.go:27 +0x2b
github.com/azure/azure-dev/cli/azd/cmd.getTargetServiceName({0x1251ec0?, 0xc0003ea7b0?}, {0x1253240?, 0xc000529040?}, 0x160?, 0xc000580000?, {0x109978e?, 0x0?}, {0xc00000a0e0, 0x3}, ...)
        github.com/azure/azure-dev/cli/azd/cmd/util.go:130 +0x18d
github.com/azure/azure-dev/cli/azd/cmd.(*restoreAction).Run(0xc000391180, {0x1251ec0?, 0xc0003ea7b0})
        github.com/azure/azure-dev/cli/azd/cmd/restore.go:131 +0x17f
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x1251ec0?, 0xc0003ea7b0?})
        github.com/azure/azure-dev/cli/azd/cmd/middleware/middleware.go:127 +0x2e8
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*HooksMiddleware).registerCommandHooks(0xc000107540?, {0x1251ec0, 0xc0003ea7b0}, 0x410965?, 0xc0004859d0?, 0xc0004a77c0)
        github.com/azure/azure-dev/cli/azd/cmd/middleware/hooks.go:88 +0x399
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*HooksMiddleware).Run(0xc000107540, {0x1251ec0?, 0xc0003ea720?}, 0xc0004a77c0)        
        github.com/azure/azure-dev/cli/azd/cmd/middleware/hooks.go:73 +0x1d8
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x1251ec0, 0xc0003ea720})
        github.com/azure/azure-dev/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*TelemetryMiddleware).Run(0xc000485920, {0x1251ec0, 0xc000042810}, 0xc0004a77c0)      
        github.com/azure/azure-dev/cli/azd/cmd/middleware/telemetry.go:85 +0x8b8
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x1251ec0, 0xc000042810})
        github.com/azure/azure-dev/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*ExperimentationMiddleware).Run(0x10a3b96?, {0x1251ec0, 0xc000042810}, 0xc0004a77c0)  
        github.com/azure/azure-dev/cli/azd/cmd/middleware/experimentation.go:64 +0x4d6
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x1251ec0, 0xc000042810})
        github.com/azure/azure-dev/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*DebugMiddleware).Run(0xc000130198, {0x1251ec0, 0xc000042810}, 0xc0004a77c0)
        github.com/azure/azure-dev/cli/azd/cmd/middleware/debug.go:48 +0x311
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x1251ec0, 0xc000042810})
        github.com/azure/azure-dev/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction(0xc00045ae10, {0x1251ec0, 0xc000042810}, 0xe1b460?, {0x1246760?, 0xc000391180})
        github.com/azure/azure-dev/cli/azd/cmd/middleware/middleware.go:131 +0x226
github.com/azure/azure-dev/cli/azd/cmd.(*CobraBuilder).configureActionResolver.func1(0xc000450780, {0xc0004847a0?, 0x1, 0x1})
        github.com/azure/azure-dev/cli/azd/cmd/cobra_builder.go:142 +0x4cf
github.com/spf13/cobra.(*Command).execute(0xc000450780, {0xc000484780, 0x1, 0x1})
        github.com/spf13/[email protected]/command.go:856 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003db680)
        github.com/spf13/[email protected]/command.go:974 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(0x1251e88?, {0x1251e88?, 0x198c080?})
        github.com/spf13/[email protected]/command.go:895 +0x47
main.main()
        D:/a/_work/1/s/cli/azd/main.go:61 +0x1fe

@RudyCo
Copy link
Author

RudyCo commented Dec 11, 2023

I can run the Web application locally successfully with the Web npm start task.
The issue is in the Restore Web task.

@vhvb1989
Copy link
Member

vhvb1989 commented Dec 11, 2023

thank you, @RudyCo , the restore issue is fixed here: #3106

@RudyCo
Copy link
Author

RudyCo commented Dec 13, 2023

thank you, @RudyCo , the restore issue is fixed here: #3106

Thanks a lot Victor! Do you know when the Azure Developer CLI will be released with this fix?

@RudyCo RudyCo closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants