You attempted to access the Error property for a successful result. A successful result has no Error.
See original GitHub issueI have receiving You attempted to access the Error property for a successful result. A successful result has no Error. error when I send value from service to controller. I receive it on service level.
public async Task<CSharpFunctionalExtensions.Result<QuestionDto>> GetQuestionWithElementsById2(int id)
{
var questionWithElements = await _tenantUnitOfWork.QuestionRepository.GetQuestionWithElementsById(id);
var questionsWithElementsDto = _mapper.Map<QuestionDto>(questionWithElements);
return Result.Success<QuestionDto>(questionsWithElementsDto);
}

Issue Analytics
- State:
- Created 5 months ago
- Comments:8
Top Results From Across the Web
You attempted to access the Value property for a failed ...
ResultSuccessException : You attempted to access the Error property for a successful result. A successful result has no Error.
Read more >Functional C#: Handling failures, input errors
As your Result type is open it means you always can just access the Value directly and you never have to check the...
Read more >Error: ValueFactory attempted to access the Value property ...
Value . This has two effects. First, it hides the original exception, overwriting it with InvalidOperationException , which makes the underlying ...
Read more >Error (The changes you requested to the table were not ...
Describes an issue in which you receive a (The changes you requested to the table were not successful) message when you insert a...
Read more >Handling operation errors - Apollo GraphQL Docs
Apollo Client helps you handle these errors according to their type, enabling you to show appropriate information to the user when an error...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The stacktrace shows that this error was thrown during response formatting, i.e. result was returned not only from service to controller, but also it was returned from controller itself.
If you want to return results from controller, you may use this extension to add corresponding converters for System.Text.Json.
huge thanks