Debugging problem #17072
Closed
rvwilliams88
started this conversation in
General
Debugging problem
#17072
Replies: 4 comments
-
Where do you see that error? On which platform? BTW, I would suggest improving your code like this... public class PeopleService : IPeopleService
{
private readonly AuthorService _authorService;
public PeopleService(AuthorService? authorService = null)
{
_authorService = authorService ?? new AuthorService();
}
public async ValueTask<IImmutableList<Person>> GetPeopleAsync(CancellationToken ct)
{
if (await _authorService.getAuthors() is null or { Length: 0 } authors)
{
return ImmutableList<Person>.Empty;
}
var people = authors.Take(6).Select(a=>a.AsPerson()).ToImmutableList();
return people;
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sorry, your code doesn't compile. (no definition for 'authors' , Author doesn't contain AsPerson, authors is a List so no Length)
What I've done is taken the standard PeopleApp sample which is XAML and C# with MVUX and converted the XAML to C# markup. That works fine with the supplied PeopleService where the value of 'people' is built into the code. Now I want to replace that with values read from a database. The code for the database is in a separate code library that is used in several other C# apps.
To try to identify where the error is occurring, I've put a 'throw new Exception' right at the start of the modified PeopleService and my message isn't displayed and this suggests to me that the error is being generated elsewhere, but where exactly?
Regards
Richard.
****************************************************
Richard Williams
email: ***@***.******@***.***>
mobile: 07981 734697
****************************************************
From: Carl de Billy ***@***.***>
Sent: Monday, June 10, 2024 5:53 PM
To: unoplatform/uno ***@***.***>
Cc: rvwilliams88 ***@***.***>; Author ***@***.***>
Subject: Re: [unoplatform/uno] Debugging problem (Discussion #17072)
Where do you see that error? On which platform?
BTW, I would suggest improving your code like this...
public class PeopleService : IPeopleService
{
private readonly AuthorService _authorService;
public PeopleService(AuthorService? authorService = null)
{
_authorService = authorService ?? new AuthorService();
}
public async ValueTask<IImmutableList<Person>> GetPeopleAsync(CancellationToken ct)
{
if (await _authorService.getAuthors() is null or { Length: 0 } authors)
{
return ImmutableList<Person>.Empty;
}
var people = authors.Take(6).Select(a=>a.AsPerson()).ToImmutableList();
return people;
}
}
-
Reply to this email directly, view it on GitHub<#17072 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A2YPRSR4B3X3IZY7H443MNTZGXKXXAVCNFSM6AAAAABJCHV5GCVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMRZG42TG>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
SOLVED. The problem was not related to the Uno Platform. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Now resolved. Problem was not related to the Uno Platform.
Regards
Richard.
****************************************************
Richard Williams
email: ***@***.******@***.***>
mobile: 07981 734697
****************************************************
From: Carl de Billy ***@***.***>
Sent: Monday, June 10, 2024 5:53 PM
To: unoplatform/uno ***@***.***>
Cc: rvwilliams88 ***@***.***>; Author ***@***.***>
Subject: Re: [unoplatform/uno] Debugging problem (Discussion #17072)
Where do you see that error? On which platform?
BTW, I would suggest improving your code like this...
public class PeopleService : IPeopleService
{
private readonly AuthorService _authorService;
public PeopleService(AuthorService? authorService = null)
{
_authorService = authorService ?? new AuthorService();
}
public async ValueTask<IImmutableList<Person>> GetPeopleAsync(CancellationToken ct)
{
if (await _authorService.getAuthors() is null or { Length: 0 } authors)
{
return ImmutableList<Person>.Empty;
}
var people = authors.Take(6).Select(a=>a.AsPerson()).ToImmutableList();
return people;
}
}
-
Reply to this email directly, view it on GitHub<#17072 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A2YPRSR4B3X3IZY7H443MNTZGXKXXAVCNFSM6AAAAABJCHV5GCVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMRZG42TG>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have changed the PeopleApp PeopleService.cs to pick up data from an external database. However when I run the code it just show "An error occurred" and nothing else. The service I am using is in current use in several other non-Uno apps but obviously something in it disagrees with Uno. Is it possible that the Uno Platform is catching an error and changing the message to An error occurred? As this message isn't produced by my service, how best should I identify the source?
Beta Was this translation helpful? Give feedback.
All reactions