Create User failing in .net managment api SDK


Been successfully using the .net SDK for the mangement api for some time, but creating a user has just failed for the first time and I can’t begin to figure out why. Have been tinkering, but not with this section of the code. The program just closes, no errors etc.

Any suggestions of where to look or at least how to debug this in visual studio would be greatly appreciated. Anyone else experiencing problems?

Program just closes on the line: Await apiClient.Users.CreateAsync(request)

Here is the relevant code:
Async Function CreateUser(ByVal userToAdd As LocalAuth0user, ByVal APItoken As String) As Task(Of Boolean)
Dim request As New Models.UserCreateRequest
request.Connection = “Username-Password-Authentication”
request.Email =
request.EmailVerified = False
request.UserMetadata = userToAdd.user_metadata
request.Password = RandomPasswordGenerator()
Dim apiClient = New ManagementApiClient(APItoken, “”)
Dim newUser As Models.User = Await apiClient.Users.CreateAsync(request)

Hi @jrhbright,

Welcome to the Auth0 Community Forum!

You can take a look in the auth0 dashboard and check your logs there. This can help to determine if there is an error with the call to the API. Otherwise you will have to debug within the application. You are not getting any errors?


Ah, brilliant. I didn’t even know about the logs - they are definitely going to be useful in the future.

However in this case unfortunately there are no errors in the log. I can see the api call just before the create user and it was fine; then nothing.

Also debugging in the application in visual studio is not currently helping as even while debugging using breakpoints and stepping into everything one line at a time the line I mentioned just causes the program to close completely with no errors. I will try looking into the debug settings to see if there is anything more I can get.


I’ve sorted this now. For others benefit it wasn’t an API problem but a issue and my inexperience with asynchronous functions.

In the end I found a much better way of calling the SDK API function which meant I was able to get the error messages back from the Auth0 calls without the program closing completely.

I am now using GetAwaiter().GetResult() rather than ‘Await’ which has the added advantage to me of not having to use async in the parent procedure.

NewUser = apiClient.Users.CreateAsync(request).GetAwaiter().GetResult()
Catch ex As ArgumentException
HandleError(“Error from CreateAsync:” & ex.Message, 2)
End Try


Thanks for clearing that up!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.