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

WPF tmpproj is excluding Microsoft.Net.Compilers.Toolset package #3308

Closed
davkean opened this issue Aug 5, 2020 · 4 comments
Closed

WPF tmpproj is excluding Microsoft.Net.Compilers.Toolset package #3308

davkean opened this issue Aug 5, 2020 · 4 comments
Assignees

Comments

@davkean
Copy link
Member

davkean commented Aug 5, 2020

Version Used:
Version 16.8.0 Preview 2.0 [30404.163.master]

Steps to Reproduce:
Build.zip

From a VS developer prompt from the above version:

  1. git clone http://github.com/dotnet/project-system
  2. cd project-system
  3. git checkout 90acd3b85ed4fa5eaef154f71d480800332a9946
  4. build.cmd

Expected Behavior:
No errors

Actual Behavior:

Errors because we're picking up csc from the VS directory instead of the package we're using:

G:\project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\ProjectSystem\VS\Waiting\VisualStudioWaitIndicator.cs(101,24): error CS8619: Nullability of reference types in value of type '
(WaitIndicatorResult Canceled, T?)' doesn't match target type '(WaitIndicatorResult, T)'. [G:\project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\Microsoft.VisualStudio.ProjectSyste
m.Managed.VS_jrfzhkfp_wpftmp.csproj]
G:\project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\ProjectSystem\VS\Waiting\VisualStudioWaitIndicator.cs(108,24): error CS8619: Nullability of reference types in value of type '
(WaitIndicatorResult Canceled, T?)' doesn't match target type '(WaitIndicatorResult, T)'. [G:\project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\Microsoft.VisualStudio.ProjectSyste
m.Managed.VS_jrfzhkfp_wpftmp.csproj]

Related part of the build log:

image

@davkean
Copy link
Member Author

davkean commented Aug 5, 2020

This is one from the same log which makes this line: http://sourceroslyn.io/#Microsoft.Build.Tasks.CodeAnalysis/ManagedCompiler.cs,499

image

@davkean
Copy link
Member Author

davkean commented Aug 5, 2020

Looking through the log, this has something to do with the autogenerated XAML project - it seems to be the only one picking up the wrong Csc:

image

@jaredpar jaredpar self-assigned this Aug 5, 2020
@jaredpar
Copy link
Member

jaredpar commented Aug 5, 2020

The problem here isn't with Microsoft.Net.Compilers.Toolset picking the wrong csc, it's that the project simply isn't using Microsoft.Net.Compilers.Toolset. The easiest way to see what is going on here is to select "View" on the project that contains the errors. This is the generated .wpftmp.csproj file. That generated file has no <PackageReference> entries in it. The trimmed down file looks essentially like this:

<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information. -->
<Project Sdk="Microsoft.NET.Sdk">
  <Import Project="..\..\build\import\VisualStudio.props" />
  <PropertyGroup>
    <RootNamespace>Microsoft.VisualStudio</RootNamespace>
    <!-- VSIX -->
    <GeneratePkgDefFile>true</GeneratePkgDefFile>
    <CreateVsixContainer>false</CreateVsixContainer>
    <!-- Nuget -->
    <IsPackable>true</IsPackable>
    <Description>Microsoft VisualStudio ProjectSystem for Managed Languages Project hosts that interact with VisualStudio interfaces.</Description>
    <Summary>Microsoft VisualStudio Managed Project System VS Components</Summary>
    <PackageTags>Roslyn Managed Project System VisualStudio</PackageTags>
    <NoWarn>$(NoWarn);NU5125</NoWarn>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\Microsoft.VisualStudio.ProjectSystem.Managed\Microsoft.VisualStudio.ProjectSystem.Managed.csproj" />
  </ItemGroup>
  <ItemGroup>
    <InternalsVisibleTo Include="Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests" />
    <InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="$(MoqPublicKey)" />
  </ItemGroup>
  <ItemGroup>
    <Compile Update="ProjectSystem\VS\LanguageServices\CSharp\CSharpCodeDomProvider.cs">
      <SubType>Component</SubType>
    </Compile>
    <!-- Lots more Compile entries -->
  </ItemGroup>
  <!-- trimmed out a few ItemGroup for resources -->
  <ItemGroup>
    <ReferencePath Include="C:\Users\dmon\.nuget\packages\envdte\8.0.1\lib\net10\EnvDTE.dll" />
    <ReferencePath Include="C:\Users\dmon\.nuget\packages\envdte80\8.0.1\lib\net10\EnvDTE80.dll" />
    <ReferencePath Include="C:\Users\dmon\.nuget\packages\envdte90\9.0.1\lib\net10\EnvDTE90.dll" />
    <ReferencePath Include="C:\Users\dmon\.nuget\packages\messagepack.annotations\2.1.90\lib\netstandard2.0\MessagePack.Annotations.dll" />
    <!-- trimmed out a couple hundred more ReferencePath entries -->
  </ItemGroup>
  <ItemGroup>
    <Compile Include="G:\project-system\artifacts\Debug\obj\Microsoft.VisualStudio.ProjectSystem.Managed.VS\ProjectSystem\VS\PropertyPages\DebugPageControl.g.cs" />
    <Compile Include="G:\project-system\artifacts\Debug\obj\Microsoft.VisualStudio.ProjectSystem.Managed.VS\ProjectSystem\VS\PropertyPages\GetProfileNameDialog.g.cs" />
    <Compile Include="G:\project-system\artifacts\Debug\obj\Microsoft.VisualStudio.ProjectSystem.Managed.VS\ProjectSystem\VS\UI\DontShowAgainMessageBox.g.cs" />
    <Compile Include="G:\project-system\artifacts\Debug\obj\Microsoft.VisualStudio.ProjectSystem.Managed.VS\GeneratedInternalTypeHelper.g.cs" />
  </ItemGroup>
</Project>

I'm a little confused why it doesn't propagate from the referenced csproj file. But given that it doesn't look like restore ever ran on this project file at all that could be the reason.

Either case though this doesn't appear to be a problem in Microsoft.Net.Compilers.Toolset. The package just doesn't seem to be involved here due to the structure of this generated tmpproj.

At the same time that does feel very wrong. The customer has added a <PackageReference> to their project and the build assets are not being included in the tmpproj that WPF generates. That can definitely lead to unexpected behavior like this.

Moving to WPF team so they can comment on the reasoning here.

@jaredpar jaredpar changed the title Microsoft.Net.Compilers.Toolset package is incorrectly picking up the compiler from VS directory WPF tmpproj is excluding Microsoft.Net.Compilers.Toolset package Aug 5, 2020
@jaredpar jaredpar transferred this issue from dotnet/roslyn Aug 5, 2020
@tmat
Copy link
Member

tmat commented Aug 5, 2020

@davkean davkean closed this as completed Aug 5, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Apr 11, 2022
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