dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.72k stars 1.07k forks source link

StackOverFlow Exception on Mac - fine on Windows #8898

Closed RickStrahl closed 4 years ago

RickStrahl commented 6 years ago

Steps to reproduce

I just installed new 2.0.3 SDK on Mac and am trying to run a project that's working fine on Windows.

When I run anydotnet command I get: image

I'm using code from this repo: https://github.com/RickStrahl/Westwind.Globalization

There are multiple .NET projects, the .NET Core one in question is the sample project in: ./src/NetCore/Westwind.Globalization.Sample.AspNetCore

and I'm running out of that folder.

This project has another project reference higher up the folder hierarchy so I'm wondering if that may be the problem.

FWIW, I restore a couple other projects on the same machine and setup and using the same SDK and they work fine. Something is different but I can't figure out what

Expected behavior

No stack overflow.

Environment data

dotnet --info output:

Product Information: Version: 2.0.3 Commit SHA-1 hash: eb1d5ee318

Runtime Environment: OS Name: Mac OS X OS Version: 10.13 OS Platform: Darwin RID: osx.10.12-x64 Base Path: /usr/local/share/dotnet/sdk/2.0.3/

Microsoft .NET Core Shared Framework Host

Version : 2.0.3 Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

livarcocc commented 6 years ago

Can you show what's the PWD that you are running this command from? Like, the full path? Also, any chance you have cyclic symbolic links somewhere in the directories used by the build? We have seen this in the past where we just keep following a cyclic symbolic link until we run out of memory.

I will try to repro this locally as well.

RickStrahl commented 6 years ago

Thanks for taking a look at this.

Your symbolic link suggestions pointed me into the right direction - there's an odd path that gets 'generated' when running on the Mac - as part of my application's code. This is a Windows app that's been moved to .NET Core and it appears there's something writing and errand file/path (backslash vs fwd slashes most likely).

Anyway this is the culprit:

image

Now I need to figure out what's creating the file there. Ugh.

livarcocc commented 6 years ago

Makes sense.

I am going to go ahead and close this issue for now. If it turns out there is something else going on here, feel free to comment and re-activate.

Thanks for getting back to us on this.

RickStrahl commented 6 years ago

Yup, but there probably is a bug there anyway - no matter what we probably shouldn't see a StackOverflow exception.

In this case it's just a badly named folder (not a symlink). I think just having a sub-folder named \ is the issue here.

livarcocc commented 6 years ago

You are right. We just checked and this happens inside the msbuild process.

I am going to go ahead and move it to msbuild's repo.

livarcocc commented 6 years ago

This issue was moved to Microsoft/msbuild#2741