microsoft / clrmd

Microsoft.Diagnostics.Runtime is a set of APIs for introspecting processes and dumps.
MIT License
1.05k stars 255 forks source link

Adding a net471 target to the nuget #230

Closed kevingosse closed 4 years ago

kevingosse commented 5 years ago

Currently, the nuget is published with two targets: net452 and netstandard2.0. Since RuntimeInformation is not supported prior to .net 4.7.1, the DataTarget always assumes it's running on Windows when compiled for net452:

https://github.com/Microsoft/clrmd/blob/e0e1d97ba82277701504733a5f0e0d23d1a1196a/src/Microsoft.Diagnostics.Runtime/src/DataTargets/DataTarget.cs#L25-L33

For various reasons, I have a library that needs to target .net framework but that I also use on Linux. Unfortunately, when resolving a PackageReference for a .net framework project, nuget always picks the netxxx target over netstandardxx (https://github.com/dotnet/sdk/issues/1791). Because of this, my library picks the net452 version of ClrMD and crashes on Linux (even though it would work just fine with the netstandard2.0 version).

Since I don't see this issue been fixed in nuget anytime soon, would it be possible to add a net471 target to the ClrMD nuget package? This way, a project targeting .net 4.7.1+ would resolve the ClrMD assembly with the OS check.

leculver commented 5 years ago

Full disclosure: I've spent most of my career working in diagnostics, debugging, and C++/assembly... When it comes to deep issues related to our build systems, targeting, and what the "Right Solution" should be here...I'm actually out of my technical depth with these kinds of issues and don't mind admitting it. =)

To answer your direct question: If adding a 471 target is the right thing to do here to unblock you, and it won't cause adverse affects for other folks, I'm 100% happy to go do that.

With that said, I'm not really qualified to know if that's the right thing for ClrMD or if that's going to have any averse effects on people who target ClrMD "regularly" and get surprised by new/changed behavior. Let me check with some devs in CLR who are more well versed in this area and make sure this will be an okay thing to do.

Can I impose on you to submit a pull request for it? I'm not sure when I can get to it otherwise (I'm off ClrMD for a short while working on an extremely high priority project). If there's a PR here and I get the ok from someone from our team, I will ship it whenever the 1.0.4 release goes out the door.

leculver commented 4 years ago

This will be fixed in ClrMD 2.0. The library will target .Net Standard 2.0 and 4.7.1.