Back

.NET SDK often throw exceptions when I try to get some values. For example

  • 0
  • Tools
  • Cloud
sharadjaiswal
4 Jan, 2025, 12:11

Following code throws exception:

Client client = new Client(configuration.ApiEndPoint, false, httpClient); client.SetEndpoint(configuration.ApiEndPoint); client.SetProject(configuration.ProjectId); client.SetJWT(token);

var account = new Account(client); var user = await account.Get();

Exception:

System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Appwrite StackTrace: at Appwrite.Models.Target.From(Dictionary2 map) at Appwrite.Models.User.<>c.<From>b__77_0(Dictionary2 it) at System.Linq.Enumerable.SelectListIterator2.Fill(ReadOnlySpan1 source, Span1 destination, Func2 func) at System.Linq.Enumerable.SelectListIterator2.ToList() at Appwrite.Models.User.From(Dictionary2 map) at Appwrite.Services.Account.<Get>g__Convert|1_0(Dictionary2 it) at Appwrite.Client.<Call>d__311.MoveNext()

Am I missing something?

TL;DR
.NET SDK throwing exceptions when attempting to retrieve values. Error suggests a null reference exception. Missing instance of an object. The issue likely lies with the `User` class handling the values improperly. This could have to do with not setting required values or incorrect configuration during setup.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more