question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CS8785: Generator 'MediatorGenerator' failed to generate source.

See original GitHub issue

I have a request that implements IRequest<byte[]>.

public class ExportRequest : IRequest<byte[]>
{
}

I have a request handler that implements IRequestHandler<ExportRequest, byte[]>.

public class ExportRequestHandler : IRequestHandler<ExportRequest, byte[]>
{
    // implementation
}

I get a CS8785 warning and no code is generated for the ExportRequestHandler. I have several other request, command and notification handlers, but this is the only one that expected to return a byte array result.

Also, the warning message is complaining: "Exception of type ‘FileNotFoundException’ with message 'Could not load file or assembly ‘System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0. blah blah blah’ or one of its dependencies.

Are there any restrictions on TResponse types?

the project that I am using this on is a .Net6.0 project in VS 2022.

Code generation fails for any array type but succeeds for everything else. Tried string[], int[], Stream[].

using version 1.0.5

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TorreyGarlandcommented, Jun 6, 2022

right now it is working fine.

If I create the code for an IRequest class, I just have to remember to at least start the shell for the corresponding IRequestHandler.

1reaction
TorreyGarlandcommented, May 10, 2022

Will try it out.

Thanks for looking into this.

please keep up the good work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.net - How to fix C# Source Generators Issue of not found ...
CSC : warning CS8785: Generator 'OpenApiClientServicesGenerator' failed to generate source. It will not contribute to the output and ...
Read more >
Build fails if SourceGenerator project has a package ...
WARNING - CSC (0, 0): CS8785: Generator 'Generator' failed to generate source. It will not contribute to the output and compilation errors ...
Read more >
Source Generators
Source Generators is a C# compiler feature that lets C# developers inspect user code as it is being compiled. Source generators create new ......
Read more >
SonarQube problem with C# Source Generators
It looks like SonarQube somehow blocks the code to be generated, because we get this error messages in the build: Error CS0246: The...
Read more >
Let's Build an Incremental Source Generator With Roslyn, by ...
This talk was part of the JetBrains .NET Days Online 2022 conference. Details: https://pages.jetbrains.com/dotnet-days-2022 Description: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found