You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does the bug reproduce also in WPF for .NET Framework 4.8?: No
Problem description:
I set the BaseIntermediateOutputPath to >$(OutputRootDirectory)obj$(Configuration)$(MSBuildProjectName)
where OutputRootDirectory is a shared Output path of many projects
It is set via a build sdk that is included in the Directory.Build.props and Directory.Build.targets files in the root of my repository.
Actual behavior:
When I build the project I get alot of build errors for xaml files, for example:
D:\Git\Collaboration\Net\Framework_out\obj\Debug\Siemens.Collaboration.Net.Presentation\netcoreapp3.0\Controls\AvalonDockApplicationControl.g.cs(54,18,54,62): error CS1504: Source file 'Controls\AvalonDockApplicationControl.xaml' could not be opened -- Could not find file.
It seems like the line information generated in to the g.cs files don't honor the the changed BaseIntermediateOutputPath setting.
@grubioe I'm not sure whether this is a duplicate. It's more about how the compiler resolves line preprocessor statements with relative paths. For example into one of the generated cs files (AvalonDockApplicationControl.g.cs) in the intermediate ouput is the following line statement generated:
I don't know how the compiler can find the path to the xaml file, because the xaml file is not relatively located to the base intermediate output in my case. I'm afraid that there's somewhere an assumption that the intermediate output is below the project directory.
I tried to set the property XamlDebuggingInformation to false, but unfortunately it doesn't stop generating the line statements. Any other idea, how i could workaround that issue?
I think I found the issue. The implementation of ParentFolderPath in the MarkupCompiler class of the PresentationBuildTasks assembly seems not to be clean:
The ParentFolderPrefix shall build up the project folder to the xaml files to which the line pragma's points to. In my case the targetpath doesn't start with the sourcefileinfo.sourcepath... therefore an empty string is returned, which is probably wrong. Instead a complex relative path or an absolute path to the project directory would have to be generated.
@TFTomSun If you know what class name you're looking for, you can go to the homepage for this repo, press the "T" key on your keyboard, and type in the class name into the File Finder page that appears. Since most filenames in this repo share names with the classes they contain, this is usually a good way to find one class from the (admittedly large) repository.
Failing that, the src directory contains all the source code for the entire WPF project, organized in subfolders by assembly, then by namespace. If you're using PowerShell, you can use the following command to find a string out of all the C# source files in the repo:
cd path_to_wpf_repo_clone\src\Microsoft.DotNet.Wpf\src
dir -Recurse .-Include *.cs | sls "your_string_here"-SimpleMatch
Or, if you prefer working on a Linux or Mac box, I would recommend using the ack program instead. All you need to do to use it is type ack some.regex.here, and it will search every file under the current directory for that regex, and print filenames and line numbers for each match it finds -- and it's fast. Hope this helps!
@wjk ok, i thought there might be a more feasible way to navigate the sources... i prefer a symbol based navigation support via decompilation until we can do that via visual code directly online one day.
@TFTomSun something like reference source but for .NET Core repositories? Roslyn and CoreFX have one for their repository as well. I'm still using the Desktop Reference Source for navigating the sources of WPF and WinForms but they are moving apart quickly, in particular WinForms is doing heavy refactoring. But for WPF it is pretty close so it still works nicely. I've created #1967 and dotnet/winforms#1982 to suggest having online browsable source.
I ran into this issue while adding packaging to a dotNet Framework based solution. Working around by narrowing who gets the 'EmbedUntrackedSources' property using a targets file.
Activity
vatsan-madhavan commentedon Aug 24, 2019
Likely related to or duplicate of #366
grubioe commentedon Aug 29, 2019
Closing as duplicate of #366
TFTomSun commentedon Sep 20, 2019
@grubioe I'm not sure whether this is a duplicate. It's more about how the compiler resolves line preprocessor statements with relative paths. For example into one of the generated cs files (AvalonDockApplicationControl.g.cs) in the intermediate ouput is the following line statement generated:
I don't know how the compiler can find the path to the xaml file, because the xaml file is not relatively located to the base intermediate output in my case. I'm afraid that there's somewhere an assumption that the intermediate output is below the project directory.
I tried to set the property XamlDebuggingInformation to false, but unfortunately it doesn't stop generating the line statements. Any other idea, how i could workaround that issue?
TFTomSun commentedon Sep 20, 2019
I think I found the issue. The implementation of ParentFolderPath in the MarkupCompiler class of the PresentationBuildTasks assembly seems not to be clean:
Assembly location:
excerpt of decompiled source code:
The ParentFolderPrefix shall build up the project folder to the xaml files to which the line pragma's points to. In my case the targetpath doesn't start with the sourcefileinfo.sourcepath... therefore an empty string is returned, which is probably wrong. Instead a complex relative path or an absolute path to the project directory would have to be generated.
@grubioe please reopen the issue
wjk commentedon Sep 20, 2019
@TFTomSun Open source is cool! No need to decompile anymore:
wpf/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs
Lines 1567 to 1585 in 55815c9
TFTomSun commentedon Sep 21, 2019
off topic
@wjk maybe I don't know a technique yet how to browse and search for symbols within the original sources. What I did:
Is there a similar way to do that based on the original sources? Finding and cloning the whole repository seems to be more complicated for me
wjk commentedon Sep 21, 2019
@TFTomSun If you know what class name you're looking for, you can go to the homepage for this repo, press the "T" key on your keyboard, and type in the class name into the File Finder page that appears. Since most filenames in this repo share names with the classes they contain, this is usually a good way to find one class from the (admittedly large) repository.
Failing that, the src directory contains all the source code for the entire WPF project, organized in subfolders by assembly, then by namespace. If you're using PowerShell, you can use the following command to find a string out of all the C# source files in the repo:
Or, if you prefer working on a Linux or Mac box, I would recommend using the ack program instead. All you need to do to use it is type
ack some.regex.here, and it will search every file under the current directory for that regex, and print filenames and line numbers for each match it finds -- and it's fast. Hope this helps!TFTomSun commentedon Sep 22, 2019
@wjk ok, i thought there might be a more feasible way to navigate the sources... i prefer a symbol based navigation support via decompilation until we can do that via visual code directly online one day.
weltkante commentedon Sep 27, 2019
@TFTomSun something like reference source but for .NET Core repositories? Roslyn and CoreFX have one for their repository as well. I'm still using the Desktop Reference Source for navigating the sources of WPF and WinForms but they are moving apart quickly, in particular WinForms is doing heavy refactoring. But for WPF it is pretty close so it still works nicely. I've created #1967 and dotnet/winforms#1982 to suggest having online browsable source.
TFTomSun commentedon Sep 27, 2019
@weltkante yes, that looks promising. I hope something like this will be integrated into github one day, so that you can use it for any project.
I even found the class i mentioned above.
https://referencesource.microsoft.com/#PresentationBuildTasks/BuildTasks/Ms/Internal/MarkupCompiler/MarkupCompiler.cs,8971d8b9b0963d26
Unfortunately I don't see a member list. So the useability still needs to be improved.
9 remaining items
[master] Update dependencies from dotnet/arcade (#7706)
Work around dotnet/wpf#1718 by not embedding untracked source
Implement a workaround for dotnet/wpf#1718
Implement a workaround for dotnet/wpf#1718
[master] Update dependencies from dotnet/arcade (#394)
Workaround dotnet/wpf#1718
epvanhouten commentedon Jun 29, 2020
I ran into this issue while adding packaging to a dotNet Framework based solution. Working around by narrowing who gets the 'EmbedUntrackedSources' property using a targets file.
.NET Core WPF Build error on custom BaseIntermediateOutputPath #1718 (#…
.NET Core WPF Build error on custom BaseIntermediateOutputPath #1718 (#…
[master] Update dependencies from dotnet/winforms (#3647)
[master] Update dependencies from dotnet/arcade (dotnet#7706)
ryalanms commentedon Aug 26, 2021
This is fixed in .NET 6.0 and 5.0 with
IncludePackageReferencesDuringMarkupCompilation = true.KirillOsenkov commentedon Nov 8, 2023
Related: dotnet/sdk#34438