-
-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source files autogenerated by tools during build are not scanned for definitions #1535
Comments
Hey @Arshia001 👋, Thank you for opening an issue. We will get back to you as https://opencollective.com/ionide
|
We should be well equipped to handle this, as we do already do design-time builds during project cracking to ensure that we're as close to a 'real' compiler as possible. If possible, could you get a structured build log by setting the Ionide settings for build logs and uploading that result? NOTE: env variables are uploaded as part of this, so if you have secrets in your env variable then maybe don't do this and instead wait for someone to diagnose your project. |
Thanks for the quick response! I'll recreate the problem in a minimal project and upload the binlog and the project itself ASAP. |
@baronfel I uploaded a minimal reproduction here: https://github.com/Arshia001/Ionide-1535-repro. The repository also contains an I'm on a company laptop, so I had to create the logs inside a container to ensure isolation. I'm pretty sure that shouldn't make a difference since we've already seen this issue on all major platforms, but I thought I'd let you know in case it does make a difference. |
So it's a bit hairy, but one different I notice between Ionide and the CLI build's binlog is that in the Ionide binlog, there's no Evaluation Phase at all. This is important because the Evaluation Phase is where your package's targets were imported, which brought them into the overall build graph. Another small difference is that Ionide does a design-time build of the |
I'm not that familiar with MSBuild, and the build scripts in the package are almost entirely copied over from the official C# package. One thing I can say for certain is that the scripts work in VS. Can I change something in the package to make it work with Ionide? I was under the impression that there's only one correct way to do build-time codegen, but it seems I was wrong. |
Oh I was just dumping some initial investigations in the above comment. It looks to me like your package is doing the correct thing. I think the problem is more on the Ionide side (specifically the proj-info library we use for project cracking), because we don't seem to be doing build evaluation the same way the CLI does. |
I've has some limited success working on ionide's evaluation, and I can now successfully perform evaluation the way the CLI does. Still digging into why we can't retrieve the correct item list from the compiler args though. |
I have exactly the same problem. |
I'm happy to say that in 5.10.1 I can't reproduce these issues! |
@baronfel I'm still seeing the issue in version 5.10.1. Is there something I can do to pinpoint the problem? |
Running into this issue in 5.10.2. @Arshia001 can you re open? |
@baronfel @Krzysztof-Cieslak Just letting you know that this issue still exists. |
Describe the bug**
Some libraries generate source files during the build process by using MSBuild targets. These generated files are not scanned for definitions, and any usage of types contained in those files is reported as an error.
Steps to reproduce
Grpc-FSharp.Tools
package in Arshia001/FSharp.GrpcCodeGenerator is one such project. This problem was in fact first reported in Works on ionide? Arshia001/FSharp.GrpcCodeGenerator#5.The value, namespace, type or module 'XXXX' is not defined. F# Compiler(39)
Expected behaviour
The autogenerated files should be scanned and their types made available.
Machine info
Additional context
There looks to be a problem with how Ionide interacts with MSBuild, since running the right MSBuild targets should generate such files and add them to
Compile
, which Ionide can then pick up.(One could argue that code generation is not the best approach for F#, and that type providers should be used instead. While this is a perfectly valid argument, source code ported from C# takes much more effort to turn into a type provider.)
This issue can be worked around by referencing the generated source in the
fsproj
directly, but with aCondition
that evaluates to true for Ionide and false for the build process. However, I know of no MSBuild properties that can be used for this purpose.The text was updated successfully, but these errors were encountered: