Skip to content

🐛 Bug Report: Create / Get User fails with "Unable to cast object of type 'System.Object[]' to type 'System.Collections.Generic.List`1[System.String]" #73

@andyzukunft

Description

@andyzukunft

👟 Reproduction steps

  • Use Appwrite .NET SDK v0.19.0 and current Apprwite Cloud or Appwrite 1.8.0-RC3 hosted backend.
  • Execute command to Appwrite backend (example: create new user, get existing user)
  • User is created in Appwrite, return result creates an exception in .NET application
[ApiController]
[Route("api/[controller]")]
public class UserController : ControllerBase
{
    public async Task<User> GetUser(Client client, string userId)
    {
        var userService = new Users(client);
        var user = await userService.Get(userId);

        return user;
    }

    public async Task<User> CreateUser(Client client, string userMail, string userName)
    {
        var userService = new Users(client);
        var user = await userService.Create(ID.Unique(), email: userMail, name: userName);

        return user;
    }
}

👍 Expected behavior

Execution should be working without exception on result return.

I have not tested it with other features as I just starting with Appwrite. Must be checked if other commands result in the same behaviour.

👎 Actual Behavior

Executing commands to Appwrite (here: UserController.CreateUser()) results in the result data to be invalid. However the user was created in Appwrite.

Exception thrown:

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.InvalidCastException: Unable to cast object of type 'System.Object[]' to type 'System.Collections.Generic.List`1[System.String]'.
         at Appwrite.Models.User.From(Dictionary`2 map)
         at Appwrite.Services.Users.<Create>g__Convert|2_0(Dictionary`2 it)
         at Appwrite.Client.Call[T](String method, String path, Dictionary`2 headers, Dictionary`2 parameters, Func`2 convert)
         at [redacted].UserController.CreateUser(Client client, String userMail, String userName) in [redacted]\UserController.cs:line 24
         at lambda_method4(Closure, Object)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

Appwrite Cloud: 2025-10-06
Appwrite Hosted: 1.8.0-RC3
Appwrite .NET SDK: 0.19.0

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions