Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add net461 as a separate target for Elastic.Apm #277

Merged
merged 4 commits into from
Jun 14, 2019
Merged

Add net461 as a separate target for Elastic.Apm #277

merged 4 commits into from
Jun 14, 2019

Conversation

gregkalapos
Copy link
Contributor

@gregkalapos gregkalapos commented Jun 13, 2019

#248 seems to break our Full Framework code, mainly because it adds System.Diagnostics.PerformanceCounter as a dependency to Elastic.Apm. We use the PerformanceCounter type from this package, but it turns out that this type is in System.dll in case of net461. The problem itself isn't specific to this class, I suspect we'd have this later with other things (so as a quick and sloppy summary: using netstandard2.0 on net461 is a pain, net461 should be a separate target, and that's what this PR proposes).

The recommendation from Microsoft is also to target net461 and netstandard2.0 separately.

Current problems/questions:

  • if we simply add <TargetFrameworks>netstandard2.0;net461</TargetFrameworks> to Elastic.Apm builds will fail on Linux (CI) and macOS (my dev machine). Therefore I added <PropertyGroup Condition=" '$(OS)' == 'Windows_NT' "> checks to only build net461 on Windows. I'm not 100% sure this is a good idea, because in this case the generated NuGet packages contain an additional net461 dll on Windows, but those are missing when we generate the packages on a non Windows OSs. I think this is very dangerous, because we may end up with a release where the net461 Elastic.Apm dll is missing. Open for ideas on how to solve this, otherwise we can go with this and think about it later.
  • Do we want to include this in the beta release? This changes things on Full Framework, so that's a risk, on the other hand, this is probably the way to go, so if we spend time to test it, I don't see any reason not to do the beta release including this change.

@SergeyKleyman feel free to push your fix to the RuntimeInformation.FrameworkDescription issue.

@@ -39,7 +39,7 @@ static ElasticApmModule()
private HttpApplication _httpApp;

private static Version AspNetVersion => typeof(HttpRuntime).Assembly.GetName().Version;
private static string ClrDescription => RuntimeInformation.FrameworkDescription;
private static string ClrDescription => "aaa"; // RuntimeInformation.FrameworkDescription;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is already on @SergeyKleyman's machine.

@v1v
Copy link
Member

v1v commented Jun 13, 2019

As I want to validate whether the GH notification checks are fine, I'll say jenkins run the tests

@codecov-io
Copy link

codecov-io commented Jun 13, 2019

Codecov Report

Merging #277 into master will increase coverage by 0.26%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
+ Coverage   79.57%   79.84%   +0.26%     
==========================================
  Files          71       71              
  Lines        2326     2287      -39     
  Branches      417      411       -6     
==========================================
- Hits         1851     1826      -25     
+ Misses        300      283      -17     
- Partials      175      178       +3
Impacted Files Coverage Δ
.../Metrics/MetricsProvider/SystemTotalCpuProvider.cs 58.18% <0%> (-6.34%) ⬇️
src/Elastic.Apm/Agent.cs 70.83% <0%> (-1.67%) ⬇️
src/Elastic.Apm/Helpers/SystemInfoHelper.cs 76.66% <0%> (-1.67%) ⬇️
src/Elastic.Apm/Helpers/PlatformDetection.cs 100% <0%> (ø) ⬆️
src/Elastic.Apm/Model/CapturedException.cs 80% <0%> (+33.33%) ⬆️
src/Elastic.Apm/Model/SpanCount.cs 100% <0%> (+55.55%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dad089c...4521554. Read the comment docs.

Copy link
Contributor

@SergeyKleyman SergeyKleyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gregkalapos
Copy link
Contributor Author

Merging this.

❗️ Very important ❗️
After this we should only release packages built on Windows! Building on non-Windows won't generate the net461 package.

@gregkalapos gregkalapos merged commit 15ba1b2 into elastic:master Jun 14, 2019
@gregkalapos gregkalapos deleted the MultiTargeting branch June 14, 2019 09:33
@gregkalapos gregkalapos self-assigned this Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants