Open WardenGnaw opened 1 year ago
@chuckries Helped point out that this may be an issue caused with the project overriding the <IntermediateOutputPath>
<IntermediateOutputPath>$(MIEngineRoot)obj\$(Configuration)\$(MSBuildProjectName)\</IntermediateOutputPath>
Just ran into this as well, ping me on Teams if you need a repro.
Works in 8.0.100-preview.3.23178.7
Still repros with 8.0.100-rc.1.23463.5. We do override IntermediateOutputPath however not doing anything crazy, just group all projects obj folder under common obj folder in the root. Each project stil has its own subfolder under common obj.
I've investigated this and found a workaround, which is to set the EmbedUntrackedSources
property to false.
@tmat This is a regression in .NET 8 that looks like it's related to Source Link embedding untracked files, can you take a look?
I compared a build of the project between the .NET 7 and the .NET 8 SDK. In the .NET 8 SDK where it fails, there are EmbeddedFiles
items passed to the compiler in the inner XAML markup compilation pass 2 build, that are not present in the .NET 7 SDK:
EmbeddedFiles
c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs
Link = ContainerPickerDialogWindow.g.cs
c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\GeneratedInternalTypeHelper.g.cs
Link = GeneratedInternalTypeHelper.g.cs
c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\GeneratedAssemblyInfo
c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs
These appear to be causing, or te be related to, the error that is being generated.
This is an old bug in nuget/wpf interaction: https://github.com/dotnet/wpf/issues/1718
IncludePackageReferencesDuringMarkupCompilation = true
is required for the fix to kick in. MIEngine repo sets this property to false in src\SSHDebugPS\SSHDebugPS.csproj
which causes the build failure.
@KirillOsenkov Is property IncludePackageReferencesDuringMarkupCompilation
set to false
in your repro project?
It doesn't appear to be set or mentioned at all.
@dsplaisted I don't have the broken SDK on this machine anymore, so if you could try setting IncludePackageReferencesDuringMarkupCompilation = true
and see if it builds successfully?
I notice that this is present for .NET Core WinFX targets: https://github.com/dotnet/wpf/blob/b9b48871d457fc1f78fa9526c0570dae8e34b488/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft.WinFX.targets#L453
But not for desktop:
I've investigated this and found a workaround, which is to set the
EmbedUntrackedSources
property to false.@tmat This is a regression in .NET 8 that looks like it's related to Source Link embedding untracked files, can you take a look?
I compared a build of the project between the .NET 7 and the .NET 8 SDK. In the .NET 8 SDK where it fails, there are
EmbeddedFiles
items passed to the compiler in the inner XAML markup compilation pass 2 build, that are not present in the .NET 7 SDK:EmbeddedFiles c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs Link = ContainerPickerDialogWindow.g.cs c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\GeneratedInternalTypeHelper.g.cs Link = GeneratedInternalTypeHelper.g.cs c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\GeneratedAssemblyInfo c:\Users\noahgilson\MIEngine\obj\Debug\SSHDebugPS\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs
These appear to be causing, or te be related to, the error that is being generated.
Thank you @dsplaisted for investigating. I could not figure out what was wrong from the binlog.
@abpiskunov Does setting NVM. I saw the email thread, looks like its working for you.IncludePackageReferencesDuringMarkupCompilation=true
solve the problem for your 3 repos?
And @tmat thanks for following up, is there a reason this may not have surfaced for customers in .NET 7 but would begin to surface in .NET 8? If so, we should create a breaking change doc.
is there a reason this may not have surfaced for customers in .NET 7 but would begin to surface in .NET 8
Yes, we enabled Source Link by default in NET 8.
we should create a breaking change doc.
+1
Let’s also create a minimal repro .csproj for easier validation. Thoughts on what the right fix should be here?
We don't really want EmbedUntrackedSources=false
for the whole project though, right? We'd ideally like it only for the $(IsWpfTempProject)
project, right? That sounds like a change that could be placed in dotnet/wpf
.
The problem though is that it's desktop WPF that is broken, would it be fixed by changes to dotnet/wpf?
/cc @pchaurasia14 FYI
@tmat would you like to drive that breaking change docs issue, or should I go ahead and get that started?
Please, get it started if you don't mind.
Just checking in here - Is there any action item for WPF regarding exposing the $(IsWpfTempProject)
property?
This is very blocking, let's get this fixed please.
Are we shipping .NET 8 with this? It's going to basically break all WPF desktop in the world. To me it looks like an absolute shipstopper.
Offline we figured out that there are two ways to get into this situation:
1.Setting <IncludePackageReferencesDuringMarkupCompilation>false</IncludePackageReferencesDuringMarkupCompilation>
UseWPF
and with manual XAML assembly referencesobj
/IntermediateOutputPath
https://github.com/dotnet/wpf/pull/8378 fixes the former.
sdk344838.zip is a repro of the latter.
Workarounds Available: Either of these should work, depending on the use cases.
IncludePackageReferencesDuringMarkupCompilation
to true in csproj EmbedUntrackedSources
as false in csproj.IntermediateOutputPath
Starting to see these in the wild as folks update to .NET 8.
Did we end up having a doc page or an aka.ms links that I can point people to?
Offline we figured out that there are two ways to get into this situation:
1.Setting
<IncludePackageReferencesDuringMarkupCompilation>false</IncludePackageReferencesDuringMarkupCompilation>
2. Having a .NET Framework-targeting project
- Using .NET SDK 8
- Without
UseWPF
and with manual XAML assembly references- With a customized
obj
/IntermediateOutputPath
dotnet/wpf#8378 fixes the former.
sdk344838.zip is a repro of the latter.
We are in second use case, targeting .NET Framework 4.7.1 while using .NET SDK 8 and redirecting to a costume IntermediateOutputPath
.
For now we are obliged to rollback to .NET 6, but it seems like there is no workaround for our use case.
Starting to see these in the wild as folks update to .NET 8.
Did we end up having a doc page or an aka.ms links that I can point people to?
aka.ms/net8wpfsl This points to the known issues page.
aka.ms/net8wpfsl This points to the known issues page.
@singhashish-wpf the workarounds suggested, i.e. setting IncludePackageReferencesDuringMarkupCompilation
to true
it submerges the famous error https://github.com/dotnet/wpf/discussions/5700
Error MC3074 The tag 'X' does not exist in XML namespace 'clr-namespace:Y'
Am I looping something ?
@bouchraRekhadda EmbedUntrackedSources set as False. Does this workaround not work for you>?
@bouchraRekhadda EmbedUntrackedSources set as False. Does this workaround not work for you>?
Unfortunately no. I still have the same error MC3074
.
@bouchraRekhadda EmbedUntrackedSources set as False. Does this workaround not work for you>?
Unfortunately no. I still have the same error
MC3074
.
Can you share a minimal repro? And the versions of SDKs you are using?
The 2nd case reproduces for me on .NET6, .NET7, .NET8 as well, Most probably I am missing something here. I heard that this is a regression in .NET8. cc:// @KirillOsenkov @rainersigwald
- Having a .NET Framework-targeting project
- Using .NET SDK 8
- Without
UseWPF
and with manual XAML assembly references- With a customized
obj
/IntermediateOutputPath
Attaching binlogs.zip binlogs.
Hi Ashish, make sure to comment out the line 21 in MainWindow.xaml.cs: C:\Users\singhashish\Downloads\sdk344838\FxWpf\MainWindow.xaml.cs(21,10)
If you see in Rainer's repro, it is commented out: https://github.com/dotnet/sdk/issues/34438#issuecomment-1787679715 https://github.com/dotnet/sdk/files/13219712/sdk344838.zip
Oh, and after you unzip the repro, make sure to run git init
in the folder and add the source files and make a commit. This way the SourceLink logic kicks in which breaks:
Thanks @KirillOsenkov for the repro steps. I was able to repro. While checking I see that the MarkupCompilePass1 and MarkupCompilePass2 targets are executing successfully. The problem happens in the CoreCompile part later for the main project(Not the temporary target assembly). Also this change would be in NETFX as i understand, While the change shouldn't be in GenerateTemporaryTargetAssembly in my understanding, but there is a lot of code diff in NETFX and NetCore versions of the file.
From what I understand, this is happening as the EmbedUntrackedSources is set as True for the main project by default and we need some mechanism to make it false for such kind of projects(IntermediateOutputPath + Reference Desktop WPF libs). Not quite sure on where that change would be, @rainersigwald Any thoughts?
I feel like this is a security issue. This will potentially disclose comments customers did not intend to disclose.
This is what I'm using to workaround:
<!-- Another XAML hack for .NET Core SDK version 8 -->
<Target Name="NETCoreSDKHack" BeforeTargets="MarkupCompilePass1" Condition="'@(Page)'!=''">
<Message Text="Copying @(Page) to output to workaround NET SDK bug https://github.com/dotnet/sdk/issues/34438" Importance="high" />
<Copy SourceFiles="@(Page)" DestinationFolder="$(IntermediateOutputPath)" />
</Target>
Describe the bug
A .NET project fails to build with the .NET 8 SDK but succeeds with the .NET 7 SDK. It seems to be an issue with the WPF generated source files not being able to find the original XAML file.
To Reproduce
dotnet build src\MIDebugEngine.sln
Errors Logs
Note: The build works if you use a .NET 7 SDK like
dotnet "C:\Program Files\dotnet\sdk\7.0.109\dotnet.dll" build src\MIDebugEngine
Exceptions (if any)
None. This is just
dotnet build
Further technical details
dotnet --info
dotnet --info output