Skip to content
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

Removing a grain interface from the project fails the build #4189

Closed
alexandrnikitin opened this issue Mar 12, 2018 · 8 comments
Closed

Removing a grain interface from the project fails the build #4189

alexandrnikitin opened this issue Mar 12, 2018 · 8 comments
Assignees
Milestone

Comments

@alexandrnikitin
Copy link

How to reproduce:

  1. Create a new project for grain interfaces
  2. Reference Microsoft.Orleans.OrleansCodeGenerator.Build 2.0.0-rc1 and Microsoft.Orleans.Runtime.Abstractions 2.0.0-rc1
  3. Add two grain interfaces
  4. Build the project so that the code will be generated
  5. Remove one interface and rebuild the project
  6. Build fails with the following output
1>------ Rebuild All started: Project: DMCTS.GrainInterfaces, Configuration: Debug Any CPU ------
1>obj\Debug\netcoreapp2.0\DMCTS.GrainInterfaces.orleans.g.cs(19,305,19,317): error CS0234: The type or namespace name 'ITreeGrainV2' does not exist in the namespace 'DMCTS.GrainInterfaces' (are you missing an assembly reference?)
1>obj\Debug\netcoreapp2.0\DMCTS.GrainInterfaces.orleans.g.cs(87,192,87,204): error CS0234: The type or namespace name 'ITreeGrainV2' does not exist in the namespace 'DMCTS.GrainInterfaces' (are you missing an assembly reference?)
1>obj\Debug\netcoreapp2.0\DMCTS.GrainInterfaces.orleans.g.cs(20,127,20,139): error CS0234: The type or namespace name 'ITreeGrainV2' does not exist in the namespace 'DMCTS.GrainInterfaces' (are you missing an assembly reference?)
1>Done building project "DMCTS.GrainInterfaces.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Deleting obj directory helps.

@sergeybykov
Copy link
Contributor

  1. Remove one interface and rebuild the project

Did you rebuild it with Build Solution or Rebuild Solution? The latter should work.

@sergeybykov sergeybykov added this to the Triage milestone Mar 12, 2018
@alexandrnikitin
Copy link
Author

I tried both, neither works. Actually Build Solution shows that the project is up-to-date, keep silence and doesn't show any error. But I believe it doesn't change the generated code which isn't correct.

@sergeybykov
Copy link
Contributor

What version of VS are you running? I just tried the following code, and both Build Solution and Rebuild Solution work fine after I comment out one of the interfaces.

using Orleans;
using System.Threading.Tasks;

namespace FooBar
{
    public interface IFoo : IGrainWithGuidKey
    {
        Task Foo();
    }

    public interface IBar : IGrainWithGuidKey
    {
        Task Bar();
    }
}

What am I doing differently? I'm running VS 15.6.1.

@alexandrnikitin
Copy link
Author

alexandrnikitin commented Mar 12, 2018 via email

@sergeybykov
Copy link
Contributor

I see. Yes, I was able to repro this. Clean Solution before Build Solution fixes it. But it's a problem that Rebuild Solution doesn't do the same.

@alexandrnikitin
Copy link
Author

I've just double checked: Clean Solution then Build Solution didn't help either. Only deleting the obj directory with generated code helped me. I'm using VS 15.6.1.

@sergeybykov
Copy link
Contributor

You are right, Clean Solution doesn't seen to help. I don't know what I did differently the first time.

@ReubenBond
Copy link
Member

ReubenBond commented Mar 14, 2018

Ah, I see the problem.
I tried reproducing this as Sergey originally did: by having both interfaces in one file, but it wouldn't repro.
The reason it fails when the interface is in its own file is that all of the files in the expanded @(Compile) item list have a modification time older than the generated file.

Now we just need to work out a way to fix this.

ReubenBond added a commit to ReubenBond/orleans that referenced this issue Mar 15, 2018
@sergeybykov sergeybykov modified the milestones: Triage, 2.0.0 Mar 15, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants