Rider intellisense not recognizing generated code from FlatSharp.

I have a project that uses FlatSharp, which generates code from flatbuffer files.  Rider is not recognizing symbols defined within the generated code.  The issue is very similar to this post:


However, the target being used by FlatSharp already uses ResolveAssemblyReferences as its BeforeTargets value.  The code compiles fine within Rider (though I did have to replace the CodeTaskFactory with the one from RosylnCodeTaskFactory as I am working in Linux).

I am wondering if there is a way to tell Rider where to look for the generated files without adding them to the project, or a way to modify the target to allow rider to be aware of the files.


This is a VERY simplified version of the target.  The original can be found in the FlatSharp nuget package:

<Target Name="FlatSharpFbsCompile" BeforeTargets="ResolveAssemblyReferences">
Command="dotnet $(CompilerPath) --nullable-warnings $(FlatSharpNullable) --input &quot;%(ProcessedFlatSharpSchema.fullpath)&quot; --includes &quot;%(ProcessedFlatSharpSchema.IncludePath)&quot; --output $(IntermediateOutputPath)"
Condition=" '%(ProcessedFlatSharpSchema.fullpath)' != '' " />
<GeneratedFbs Include="$(IntermediateOutputPath)*.generated.cs" />
<Compile Include="@(GeneratedFbs)" />
<FileWrites Include="@(GeneratedFbs)" />
Comment actions Permalink

Hi -- this is James Courtney from FlatSharp. I don't actually test with Rider, so I'm not familiar with this particular problem.

My one suggestion is that you can invoke the FlatSharp compiler yourself with a prebuild task and just drop the `fbs.generated.cs` files in the main solution directory. Presumably that would allow Rider to discover the symbols. This is similar to what Unity users have to do since they don't get to modify their .csproj files. I know this isn't ideal, but I think it could unblock you.

If you end up finding a better solution, please contribute it back to FlatSharp. I always want to make it better, so contributions are very welcome!

Comment actions Permalink

Hi James Courtney! Thank you for the suggestion. 

James Colbert, could you please try it? Please, let us know if this solution does not fit you. We'll investigate the case and try to find another one. 

Comment actions Permalink

I'm not sure what was wrong, but it seems to be working as expected now.  I did update rider, so perhaps it was an old bug that has already been resolved.  For now, let's just consider it fixed and I will get back to you if there are further issues.


Please sign in to leave a comment.