Skip to content

Stack Overflow in ReferenceResolver.cs when web project references WPF library #12693

@rainersigwald

Description

@rainersigwald

This was filed as dotnet/msbuild#4560, but the proximate cause of the failure is here, as described below.

Describe the bug

Using .NET Core SDK 3.0.100-preview7, when a web project references a library that uses WPF, the build fails with a stack overflow (and very little information).

To Reproduce

msbuild4560.zip

Steps to reproduce the behavior:

  1. Using .NET Core SDK 3.0.0-preview8-27919-09 (also reported on public preview7)
  2. Build the attached zip with dotnet build WebApp\WebApp.csproj
$ dotnet build
Microsoft (R) Build Engine version 16.3.0-preview-19369-03+db6ae5a0d for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 84.2 ms for S:\repro\microsoft\msbuild\issues\4560\WebApp\WebApp.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  LibWithWpf -> S:\repro\microsoft\msbuild\issues\4560\LibWithWpf\bin\Debug\netcoreapp3.0\LibWithWpf.dll
Stack overflow.

Expected behavior

Successful build or actionable error.

Additional context

I caught this in the debugger and found that it's recursing at

https://github.com/aspnet/AspNetCore-Tooling/blob/7c5826c2abfe90e20acc3715cf9e939db1b1a442/src/Razor/src/Microsoft.NET.Sdk.Razor/ReferenceResolver.cs#L89

I added a tracepoint to indicate what is being resolved and got this: https://gist.github.com/rainersigwald/791d5ead4580da117f55886cfd1e6bd8

The tail end of that log points out the problem, I think: ReachFramework.dll depends on PresentationFramework.dll depends on ReachFramework.dll in a cycle.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions