nexogen-international / Nexogen.Libraries.Metrics

Library for collecting application metrics in .NET and exporting them to Prometheus
MIT License
61 stars 9 forks source link

.net framework compatibility #24

Open talarari opened 6 years ago

talarari commented 6 years ago

i'm trying to run this on .net 4.6.1 and getting this error:

System.MissingMethodException occurred
  HResult=0x80131513
  Message=Method not found: 'System.Collections.Generic.IEnumerable`1<!!0> System.Linq.Enumerable.Prepend(System.Collections.Generic.IEnumerable`1<!!0>, !!0)'.
  Source=Nexogen.Libraries.Metrics.Extensions
  StackTrace:
   at Nexogen.Libraries.Metrics.Extensions.Buckets.BucketGenerator.Buckets(Double[] bounds)
   at Nexogen.Libraries.Metrics.BucketExtensions.Buckets(IHistogramBuilder builder, Double[] bounds)
   at Nexogen.Libraries.Metrics.Prometheus.AspCore.HttpMetrics..ctor(IMetrics m)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
   at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass3_0.<UseMiddleware>b__0(RequestDelegate next)
   at Microsoft.AspNetCore.Builder.Internal.ApplicationBuilder.Build()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at OrleansDashboard.Dashboard.<Init>d__15.MoveNext() in C:\Users\tal\dev\OrleansDashboard\OrleansDashboard\Dashboard.cs:line 99

i see you have a compat library, but it only adds the required extensions in .net 4.5.2 https://github.com/nexogen-international/Nexogen.Libraries.Metrics/blob/a319299390ad59423d20b596f1fa16e8c579a374/Nexogen.Libraries.Metrics.Extensions/Compat/LinqExtensions.cs#L1

this needs to be done all the way to .net 4.7.x

kodfodrasz commented 6 years ago

Hi @talarari,

Thank you for reporting the problem. We are sorry to hear that the library is not suitable for you in its current form.

We hope you understand that properly supporting compatibility over multiple Framework versions requires quite some effort, and the library is not in that stage of maturity yet.

For the time being we are using it actively on .Net Core only, and CI is only available for that environment now. Framework version 4.5.2 support code is a residue from a previous legacy usecase, for which we had internal CI before the library was published on GitHub.

We are investigating the scope of the needed CI environment to ensure compatibility across .Net Framework versions, to be able to decide which Framework versions or NetStandard versions we are aiming to support.

For the time being as a fill-gap measure feel free to send a PR for the very framework version you need, provided you have tested that in your environment.

phnx47 commented 6 years ago

Alternatives for .Net Framework: