question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

This was filed as microsoft/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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pranavkmcommented, Jul 29, 2019

Thanks @rainersigwald. @peter-bull while we resolve this bug, you could workaround the issue by disabling the feature. Here’s what you need to set in your project file:

<PropertyGroup>
    <GenerateMvcApplicationPartsAssemblyAttributes>false</GenerateMvcApplicationPartsAssemblyAttributes>
</PropertyGroup>

in your project

Read more comments on GitHub >

github_iconTop Results From Across the Web

.NET Core Preview 7 - Child node "2" exited prematurely / ...
The stack overflow that's causing the problem: Stack Overflow in ReferenceResolver.cs when web project references WPF library aspnetcore# ...
Read more >
Why can't I reference my class library?
I right click the Bin folder or Project and select Add Reference, then select my Class Library Project, it adds the 15 or...
Read more >
Stack Overflow as a reference in a professional paper/ ...
Suppose I'm doing an academic paper, journal article, or other professional presentation. Would you say that it would be possible to use Stack...
Read more >
WebView control for Windows Forms and WPF
The WebView control shows web content in your Windows Forms or WPF desktop application. This is one of several wrapped Universal Windows ...
Read more >
MapControl for Windows Forms and WPF
The MapControl class enables you to display a symbolic or photorealistic map in your Windows Forms or WPF desktop application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found