From 105b223de29380873841597dc11974c8848829a0 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Thu, 23 Sep 2021 18:11:12 -0700 Subject: [PATCH 1/8] IN PROGRESS: Asp.Net Core middleware refactoring --- .../Rollbar.NetCore.AspNet.csproj | 15 +++ .../RollbarHttpAttributes.cs | 94 +++++++++++++++++++ .../RollbarHttpContextPackageDecorator.cs | 15 ++- Rollbar.NetCore.AspNet/RollbarMiddleware.cs | 17 +++- .../Config/RollbarInfrastructureOptions.cs | 22 +++-- Rollbar/IRollbarInfrastructureOptions.cs | 4 +- Samples/Sample.AspNetCore.WebApp/Startup.cs | 4 +- .../Controllers/ValuesController.cs | 40 +++++--- .../Sample.AspNetCore2.WebApi.csproj | 2 +- Samples/Sample.AspNetCore2.WebApi/Startup.cs | 29 +++--- 10 files changed, 198 insertions(+), 44 deletions(-) diff --git a/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj b/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj index 4fd6183a..1fff7fb1 100644 --- a/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj +++ b/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj @@ -23,6 +23,21 @@ + + + + NET_STANDARD + $(DefineConstants);NETSTANDARD_2_0 + + + + + NET_CORE + $(DefineConstants);NETCORE_2_0 + + + + diff --git a/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs b/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs index 8e847f13..f14c4e64 100644 --- a/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs +++ b/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs @@ -1,8 +1,17 @@ namespace Rollbar.NetCore.AspNet { + using System; + using System.IO; + using System.Text; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; +#if(NETSTANDARD_2_0 || NETCORE_2_0) + using Microsoft.AspNetCore.Http.Internal; +#endif + /// /// Implements a capture bag of HTTP context attributes of interest. /// @@ -40,6 +49,7 @@ public RollbarHttpAttributes(HttpContext? context) this.RequestQuery = context.Request.QueryString; this.RequestProtocol = context.Request.Protocol; this.RequestScheme = context.Request.Scheme; + this.RequestBody = RollbarHttpAttributes.CaptureRequestBody(context.Request).Result; } if (context.Response != null) { @@ -74,6 +84,12 @@ public RollbarHttpAttributes(HttpContext? context) /// The request method. public string? RequestMethod { get; } + /// + /// Gets the request body. + /// + /// The request body. + public string? RequestBody { get; } + /// /// Gets the request headers. /// @@ -109,5 +125,83 @@ public RollbarHttpAttributes(HttpContext? context) /// /// The response headers. public IHeaderDictionary? ResponseHeaders { get; } + + /// + /// Captures the request body. + /// + /// The request. + /// System.String. + public static async Task CaptureRequestBody(HttpRequest request) + { + var body = string.Empty; + if(request.ContentLength == null + || !(request.ContentLength > 0) + || !request.Body.CanSeek + ) + { + return body; + } + + // Prepare to snal the request body: + //Stream bodyStream = request.Body; // cache body stream +#if(NETSTANDARD_2_0 || NETCORE_2_0) + request.EnableRewind(); // so that we can rewind the body stream once we are done +#else + request.EnableBuffering(); // so that we can rewind the body stream once we are done +#endif + + ////Snap the body stream content: + //byte[] dataBuffer = new byte[Convert.ToInt32(request.ContentLength)]; + //request.Body.Seek(0, SeekOrigin.Begin); + //await request.Body.ReadAsync(dataBuffer, 0, dataBuffer.Length); + //string bodyContent = Encoding.UTF8.GetString(dataBuffer); + //return bodyContent; + + //string? bodyContent = null; + //using(StreamReader stream = new StreamReader(request.Body)) + //{ + // bodyContent = stream.ReadToEnd(); + //} + + //// Rewind/restore the request body back: + //request.Body = bodyStream; + + ////return bodyContent; + //return bodyContent; + + + + request.Body.Position = 0; + using(var ms = new MemoryStream()) + { + request.Body.CopyTo(ms); + var b = ms.ToArray(); + body = Encoding.UTF8.GetString(b); //Assign body to bodyStr + } + + return body; + } + + /// + /// Captures the response body. + /// + /// The response. + /// System.String. + public static async Task CaptureResponseBody(HttpResponse response) + { + // Make sure we start at the beginning of the body stream: + response.Body.Seek(0, SeekOrigin.Begin); + + // Snap the body stream content: + string bodyContent = await new StreamReader(response.Body).ReadToEndAsync(); + + // Reset back to the beginning of the body stream: + response.Body.Seek(0, SeekOrigin.Begin); + + //Return the string for the response, including the status code (e.g. 200, 404, 401, etc.) + return bodyContent; + } + + } } diff --git a/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs b/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs index 44fefa99..1da23aee 100644 --- a/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs +++ b/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs @@ -24,7 +24,10 @@ public class RollbarHttpContextPackageDecorator /// /// The package to decorate. /// The rollbar HTTP context. - public RollbarHttpContextPackageDecorator(IRollbarPackage packageToDecorate, RollbarHttpContext rollbarHttpContext) + public RollbarHttpContextPackageDecorator( + IRollbarPackage packageToDecorate, + RollbarHttpContext rollbarHttpContext + ) : this(packageToDecorate, rollbarHttpContext, false) { } @@ -35,7 +38,11 @@ public RollbarHttpContextPackageDecorator(IRollbarPackage packageToDecorate, Rol /// The package to decorate. /// The rollbar HTTP context. /// if set to true [must apply synchronously]. - public RollbarHttpContextPackageDecorator(IRollbarPackage packageToDecorate, RollbarHttpContext rollbarHttpContext, bool mustApplySynchronously) + public RollbarHttpContextPackageDecorator( + IRollbarPackage packageToDecorate, + RollbarHttpContext rollbarHttpContext, + bool mustApplySynchronously + ) : base(packageToDecorate, mustApplySynchronously) { this._rollbarHttpContext = rollbarHttpContext; @@ -108,6 +115,10 @@ protected override void Decorate(Data? rollbarData) rollbarData.Request.Headers.Add(header.Key, StringUtility.Combine(header.Value, ", ")); } } + if(!string.IsNullOrWhiteSpace(this._rollbarHttpContext.HttpAttributes.RequestBody)) + { + rollbarData.Request.PostBody = this._rollbarHttpContext.HttpAttributes.RequestBody; + } if (rollbarData.Response == null) { diff --git a/Rollbar.NetCore.AspNet/RollbarMiddleware.cs b/Rollbar.NetCore.AspNet/RollbarMiddleware.cs index 7e2b1866..db4b7f02 100644 --- a/Rollbar.NetCore.AspNet/RollbarMiddleware.cs +++ b/Rollbar.NetCore.AspNet/RollbarMiddleware.cs @@ -10,6 +10,8 @@ namespace Rollbar.NetCore.AspNet using Rollbar.AppSettings.Json; using System; using System.Threading.Tasks; + using System.Text; + using System.IO; /// /// Implements an Asp.Net Core middleware component @@ -84,19 +86,19 @@ RequestDelegate nextRequestProcessor /// A middleware invocation/execution task. public async Task Invoke(HttpContext? context) { - // as we learned from a field issue, apparently a middleware can even be invoked without a valid HttPContext: + // as we learned from a field issue, apparently a middleware can even be invoked without a valid HttpContext: string? requestId = null; requestId = context?.Features? .Get()? .TraceIdentifier; -#if (NETSTANDARD2_1 || NETCOREAPP3_0) - context?.Request.EnableBuffering(); +#if(NETSTANDARD_2_0 || NETCORE_2_0) + context?.Request.EnableRewind(); // so that we can rewind the body stream once we are done #else - context?.Request.EnableRewind(); + context?.Request.EnableBuffering(); // so that we can rewind the body stream once we are done #endif - using (_logger.BeginScope($"Request: {requestId ?? string.Empty}")) + using(_logger.BeginScope($"Request: {requestId ?? string.Empty}")) { NetworkTelemetry? networkTelemetry = null; @@ -211,5 +213,10 @@ public async Task Invoke(HttpContext? context) } } } + + + + + } } diff --git a/Rollbar/Config/RollbarInfrastructureOptions.cs b/Rollbar/Config/RollbarInfrastructureOptions.cs index c3af926a..4807cacf 100644 --- a/Rollbar/Config/RollbarInfrastructureOptions.cs +++ b/Rollbar/Config/RollbarInfrastructureOptions.cs @@ -32,6 +32,11 @@ public class RollbarInfrastructureOptions /// private const int defaultMaxItems = 10; + /// + /// The default value to capture uncaught exceptions + /// + private const bool defaultCaptureUncaughtExceptions = true; + /// /// Initializes a new instance of the class. /// @@ -65,17 +70,20 @@ public RollbarInfrastructureOptions(TimeSpan payloadPostTimeout) /// The payload post timeout. /// The reporting queue depth. /// The maximum items. + /// if set to true to capture uncaught exceptions. public RollbarInfrastructureOptions( int? maxReportsPerMinute, TimeSpan payloadPostTimeout, int reportingQueueDepth = RollbarInfrastructureOptions.defaultReportingQueueDepth, - int maxItems = RollbarInfrastructureOptions.defaultMaxItems + int maxItems = RollbarInfrastructureOptions.defaultMaxItems, + bool captureUncaughtExceptions = RollbarInfrastructureOptions.defaultCaptureUncaughtExceptions ) { - MaxReportsPerMinute = maxReportsPerMinute; - ReportingQueueDepth = reportingQueueDepth; - PayloadPostTimeout = payloadPostTimeout; - MaxItems = maxItems; + this.MaxReportsPerMinute = maxReportsPerMinute; + this.ReportingQueueDepth = reportingQueueDepth; + this.PayloadPostTimeout = payloadPostTimeout; + this.MaxItems = maxItems; + this.CaptureUncaughtExceptions = captureUncaughtExceptions; } /// @@ -117,9 +125,9 @@ public int MaxItems } /// - /// Gets or sets a value indicating whether [capture uncaught exceptions]. + /// Gets or sets a value indicating whether to capture uncaught exceptions. /// - /// true if [capture uncaught exceptions]; otherwise, false. + /// true if to capture uncaught exceptions; otherwise, false. public bool CaptureUncaughtExceptions { get; set; diff --git a/Rollbar/IRollbarInfrastructureOptions.cs b/Rollbar/IRollbarInfrastructureOptions.cs index 00b27b9c..9b3061d7 100644 --- a/Rollbar/IRollbarInfrastructureOptions.cs +++ b/Rollbar/IRollbarInfrastructureOptions.cs @@ -50,9 +50,9 @@ int MaxItems } /// - /// Gets or sets a value indicating whether [capture uncaught exceptions]. + /// Gets or sets a value indicating whether to capture uncaught exceptions. /// - /// true if [capture uncaught exceptions]; otherwise, false. + /// true if to capture uncaught exceptions; otherwise, false. bool CaptureUncaughtExceptions { get; set; diff --git a/Samples/Sample.AspNetCore.WebApp/Startup.cs b/Samples/Sample.AspNetCore.WebApp/Startup.cs index b5f42743..c45b7061 100644 --- a/Samples/Sample.AspNetCore.WebApp/Startup.cs +++ b/Samples/Sample.AspNetCore.WebApp/Startup.cs @@ -92,8 +92,8 @@ private void ConfigureRollbarInfrastructure() RollbarDataSecurityOptions dataSecurityOptions = new RollbarDataSecurityOptions(); dataSecurityOptions.ScrubFields = new string[] { - "url", - "method", + "url", + "method", }; config.RollbarLoggerConfig.RollbarDataSecurityOptions.Reconfigure(dataSecurityOptions); diff --git a/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs b/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs index 14d5857e..81eb6106 100644 --- a/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs +++ b/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs @@ -49,9 +49,10 @@ public IEnumerable Get() //streamWriter.WriteLine($"{DateTime.Now} Adding response body"); //streamWriter.Flush(); - //await streamWriter.WriteLineAsync($"{DateTime.Now} Adding response body"); - //await streamWriter.FlushAsync(); - + StreamWriter streamWriter = new StreamWriter(this._httpContextAccessor.HttpContext.Response.Body); + streamWriter.WriteLineAsync($"{DateTime.Now} Adding response body"); + streamWriter.FlushAsync(); + //await this._httpContextAccessor.HttpContext.Response.BodyWriter.WriteAsync(Encoding.UTF8.GetBytes("Adding response body")); //await this._httpContextAccessor.HttpContext.Response.BodyWriter.FlushAsync(); @@ -72,11 +73,32 @@ public IEnumerable Get() } //// Let's simulate an unhandled exception: - throw new Exception("AspNetCore2.WebApi sample: Unhandled exception within the ValueController.Get()"); + //throw new Exception("AspNetCore2.WebApi sample: Unhandled exception within the ValueController.Get()"); return new string[] { "value1", "value2" }; } + public class Record + { + public int ID { get; set; } + public string Email { get; set; } + public DateTime Timestamp { get; set; } + } + + // GET api/values/100 + [HttpGet("{id}")] + public ActionResult GetByID(int id) + { + var record = new Record() + { + ID = id, + Email = "NNN@mi6.com", + Timestamp = DateTime.Now + }; + + return Ok(record); + } + private void FakeExceptionCallStack(ref int level) { level++; @@ -91,18 +113,12 @@ private void Rollbar_InternalEvent(object sender, Rollbar.RollbarEventArgs e) { } - // GET api/values/5 - [HttpGet("{id}")] - public string Get(int id) - { - return "value"; - } - // POST api/values [HttpPost] public void Post([FromBody]string value) { - throw new Exception("AspNetCore2.WebApi sample: Unhandled exception within the ValueController.Post(...)"); + this._logger.LogTrace(nameof(ValuesController) + $".Post(...) is called with bod."); + //throw new Exception("AspNetCore2.WebApi sample: Unhandled exception within the ValueController.Post(...)"); } // PUT api/values/5 diff --git a/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj b/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj index 0ec0f05c..7f36a537 100644 --- a/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj +++ b/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj @@ -18,7 +18,7 @@ - + diff --git a/Samples/Sample.AspNetCore2.WebApi/Startup.cs b/Samples/Sample.AspNetCore2.WebApi/Startup.cs index a99e100c..9c55cf8c 100644 --- a/Samples/Sample.AspNetCore2.WebApi/Startup.cs +++ b/Samples/Sample.AspNetCore2.WebApi/Startup.cs @@ -9,6 +9,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; + using Microsoft.OpenApi.Models; + using Rollbar; using Rollbar.NetCore.AspNet; @@ -31,10 +33,10 @@ public void ConfigureServices(IServiceCollection services) //{"Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'. To use 'IApplicationBuilder.UseMvc' set 'MvcOptions.EnableEndpointRouting = false' inside 'ConfigureServices(...)."} services.AddMvc(options => options.EnableEndpointRouting = false); services.AddOptions(); - //services.Configure(options => - //{ - // options.AllowSynchronousIO = true; - //}); + services.Configure(options => + { + options.AllowSynchronousIO = true; + }); services.AddSingleton(); @@ -46,10 +48,10 @@ public void ConfigureServices(IServiceCollection services) }); // Register the Swagger generator, defining 1 or more Swagger documents - //services.AddSwaggerGen(c => - //{ - // c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" }); - //}); + services.AddSwaggerGen(c => + { + c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" }); + }); services.AddMvc(); } @@ -68,14 +70,14 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) // go below this line: // Enable middleware to serve generated Swagger as a JSON endpoint. - //app.UseSwagger(); + app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. - //app.UseSwaggerUI(c => - //{ - // c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); - //}); + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + }); app.UseMvc(); } @@ -89,6 +91,7 @@ private void ConfigureRollbarSingleton() RollbarSamplesSettings.AccessToken, RollbarSamplesSettings.Environment ); + config.RollbarLoggerConfig.RollbarDeveloperOptions.LogLevel = ErrorLevel.Debug; //RollbarDataSecurityOptions dataSecurityOptions = new RollbarDataSecurityOptions(); //dataSecurityOptions.ScrubFields = new string[] //{ From c0f5d33e7b60d7bd966b7ae41467c345aee14a07 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Mon, 27 Sep 2021 16:52:25 -0700 Subject: [PATCH 2/8] IN PROGRESS: Asp.Net Core middleware refactoring --- .../RollbarHttpAttributes.cs | 104 +++++++------ .../RollbarHttpContextPackageDecorator.cs | 4 + .../PipelineReaderUtil.cs | 99 +++++++++++++ .../Rollbar.NetPlatformExtensions.csproj | 1 + Samples/Sample.AspNetCore.WebApi.sln | 59 ++++++++ .../Controllers/WeatherForecastController.cs | 85 +++++++++++ Samples/Sample.AspNetCore.WebApi/Program.cs | 27 ++++ .../Properties/launchSettings.json | 31 ++++ .../Sample.AspNetCore.WebApi.csproj | 21 +++ Samples/Sample.AspNetCore.WebApi/Startup.cs | 138 ++++++++++++++++++ .../WeatherForecast.cs | 29 ++++ .../appsettings.Development.json | 9 ++ .../Sample.AspNetCore.WebApi/appsettings.json | 10 ++ .../Controllers/ValuesController.cs | 7 +- .../Sample.AspNetCore2.WebApi.csproj | 2 +- Samples/Sample.AspNetCore2.WebApi/Startup.cs | 8 +- 16 files changed, 583 insertions(+), 51 deletions(-) create mode 100644 Rollbar.NetPlatformExtensions/PipelineReaderUtil.cs create mode 100644 Samples/Sample.AspNetCore.WebApi.sln create mode 100644 Samples/Sample.AspNetCore.WebApi/Controllers/WeatherForecastController.cs create mode 100644 Samples/Sample.AspNetCore.WebApi/Program.cs create mode 100644 Samples/Sample.AspNetCore.WebApi/Properties/launchSettings.json create mode 100644 Samples/Sample.AspNetCore.WebApi/Sample.AspNetCore.WebApi.csproj create mode 100644 Samples/Sample.AspNetCore.WebApi/Startup.cs create mode 100644 Samples/Sample.AspNetCore.WebApi/WeatherForecast.cs create mode 100644 Samples/Sample.AspNetCore.WebApi/appsettings.Development.json create mode 100644 Samples/Sample.AspNetCore.WebApi/appsettings.json diff --git a/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs b/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs index f14c4e64..2730099f 100644 --- a/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs +++ b/Rollbar.NetCore.AspNet/RollbarHttpAttributes.cs @@ -8,6 +8,8 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; + using Rollbar.NetPlatformExtensions; + #if(NETSTANDARD_2_0 || NETCORE_2_0) using Microsoft.AspNetCore.Http.Internal; #endif @@ -17,6 +19,9 @@ /// public class RollbarHttpAttributes { + //private readonly HttpResponse _httpResponse; + private readonly HttpContext? _httpContext; + /// /// Prevents a default instance of the class from being created. /// @@ -37,6 +42,8 @@ public RollbarHttpAttributes(HttpContext? context) return; } + this._httpContext = context; + this.RequestID = context.Features? .Get()? .TraceIdentifier; @@ -49,7 +56,7 @@ public RollbarHttpAttributes(HttpContext? context) this.RequestQuery = context.Request.QueryString; this.RequestProtocol = context.Request.Protocol; this.RequestScheme = context.Request.Scheme; - this.RequestBody = RollbarHttpAttributes.CaptureRequestBody(context.Request).Result; + this.RequestBody = RollbarHttpAttributes.CaptureRequestBody(context.Request); } if (context.Response != null) { @@ -126,60 +133,50 @@ public RollbarHttpAttributes(HttpContext? context) /// The response headers. public IHeaderDictionary? ResponseHeaders { get; } + /// + /// Gets the response body. + /// + /// The response body. + public string? ResponseBody + { + get + { + return RollbarHttpAttributes.CaptureResponseBody(this._httpContext.Response); + } + } + /// /// Captures the request body. /// /// The request. /// System.String. - public static async Task CaptureRequestBody(HttpRequest request) + public static string? CaptureRequestBody(HttpRequest request) { - var body = string.Empty; if(request.ContentLength == null || !(request.ContentLength > 0) || !request.Body.CanSeek ) { - return body; + return null; } - // Prepare to snal the request body: - //Stream bodyStream = request.Body; // cache body stream -#if(NETSTANDARD_2_0 || NETCORE_2_0) - request.EnableRewind(); // so that we can rewind the body stream once we are done -#else - request.EnableBuffering(); // so that we can rewind the body stream once we are done -#endif - - ////Snap the body stream content: - //byte[] dataBuffer = new byte[Convert.ToInt32(request.ContentLength)]; - //request.Body.Seek(0, SeekOrigin.Begin); - //await request.Body.ReadAsync(dataBuffer, 0, dataBuffer.Length); - //string bodyContent = Encoding.UTF8.GetString(dataBuffer); - //return bodyContent; - - //string? bodyContent = null; - //using(StreamReader stream = new StreamReader(request.Body)) - //{ - // bodyContent = stream.ReadToEnd(); - //} - - //// Rewind/restore the request body back: - //request.Body = bodyStream; - - ////return bodyContent; - //return bodyContent; - + string? bodyContent = null; - - request.Body.Position = 0; + // Snap the request body: +//#if(NETSTANDARD_2_0 || NETCORE_2_0) +// request.EnableRewind(); // so that we can rewind the body stream once we are done +//#else +// request.EnableBuffering(); // so that we can rewind the body stream once we are done +//#endif +// request.Body.Position = 0; using(var ms = new MemoryStream()) { request.Body.CopyTo(ms); var b = ms.ToArray(); - body = Encoding.UTF8.GetString(b); //Assign body to bodyStr + bodyContent = Encoding.UTF8.GetString(b); //Assign body to bodyStr } - return body; + return bodyContent; } /// @@ -187,21 +184,40 @@ public RollbarHttpAttributes(HttpContext? context) /// /// The response. /// System.String. - public static async Task CaptureResponseBody(HttpResponse response) + public static string? CaptureResponseBody(HttpResponse response) { - // Make sure we start at the beginning of the body stream: - response.Body.Seek(0, SeekOrigin.Begin); - // Snap the body stream content: - string bodyContent = await new StreamReader(response.Body).ReadToEndAsync(); + if (response.ContentLength == null + || !(response.ContentLength > 0) + || !response.Body.CanSeek + ) + { + return null; + } + + string? bodyContent = null; + + //// Make sure we start at the beginning of the body stream: + //response.Body.Seek(0, SeekOrigin.Begin); + + //// Snap the body stream content: + //bodyContent = new StreamReader(response.Body).ReadToEnd(); + + //// Reset back to the beginning of the body stream: + //response.Body.Seek(0, SeekOrigin.Begin); + + response.Body.Position = 0; + using(var ms = new MemoryStream()) + { + response.Body.CopyTo(ms); + var b = ms.ToArray(); + bodyContent = Encoding.UTF8.GetString(b); //Assign body to bodyStr + } + response.Body.Position = 0; - // Reset back to the beginning of the body stream: - response.Body.Seek(0, SeekOrigin.Begin); //Return the string for the response, including the status code (e.g. 200, 404, 401, etc.) return bodyContent; } - - } } diff --git a/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs b/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs index 1da23aee..80ab2f4a 100644 --- a/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs +++ b/Rollbar.NetCore.AspNet/RollbarHttpContextPackageDecorator.cs @@ -139,6 +139,10 @@ protected override void Decorate(Data? rollbarData) rollbarData.Response.Headers.Add(header.Key, StringUtility.Combine(header.Value, ", ")); } } + if(!string.IsNullOrWhiteSpace(this._rollbarHttpContext.HttpAttributes.ResponseBody)) + { + rollbarData.Response.Body = this._rollbarHttpContext.HttpAttributes.ResponseBody; + } } } diff --git a/Rollbar.NetPlatformExtensions/PipelineReaderUtil.cs b/Rollbar.NetPlatformExtensions/PipelineReaderUtil.cs new file mode 100644 index 00000000..0d795560 --- /dev/null +++ b/Rollbar.NetPlatformExtensions/PipelineReaderUtil.cs @@ -0,0 +1,99 @@ +namespace Rollbar.NetPlatformExtensions +{ + using System; + using System.Buffers; + using System.Collections.Generic; + using System.IO.Pipelines; + using System.Text; + using System.Threading.Tasks; + + /// + /// Class PipelineReaderUtil. + /// + public static class PipelineReaderUtil + { + /// + /// Gets the pipe content as string. + /// + /// The reader. + /// System.String. + public static async Task GetPipeContentAsString(PipeReader reader) + { + var contentStrings = await PipelineReaderUtil.GetListOfStringsFromPipe(reader); + + StringBuilder stringBuilder = new StringBuilder(); + foreach(var str in contentStrings) + { + stringBuilder.AppendLine(str); + } + + return stringBuilder.ToString(); + } + + /// + /// Gets the list of strings from pipe. + /// + /// The reader. + /// List<System.String>. + public static async Task> GetListOfStringsFromPipe(PipeReader reader) + { + List results = new List(); + + while(true) + { + ReadResult readResult = await reader.ReadAsync(); + var buffer = readResult.Buffer; + + SequencePosition? position = null; + + do + { + // Look for a EOL in the buffer + position = buffer.PositionOf((byte) '\n'); + + if(position != null) + { + var readOnlySequence = buffer.Slice(0, position.Value); + AddStringToList(results, in readOnlySequence); + + // Skip the line + the \n character (basically position) + buffer = buffer.Slice(buffer.GetPosition(1, position.Value)); + } + } + while(position != null); + + + if(readResult.IsCompleted && buffer.Length > 0) + { + AddStringToList(results, in buffer); + } + + reader.AdvanceTo(buffer.Start, buffer.End); + + // At this point, buffer will be updated to point one byte after the last + // \n character. + if(readResult.IsCompleted) + { + break; + } + } + + return results; + } + + /// + /// Adds the string to list. + /// + /// The results. + /// The read only sequence. + private static void AddStringToList(List results, in ReadOnlySequence readOnlySequence) + { + // Separate method because Span/ReadOnlySpan cannot be used in async methods + //ReadOnlySpan span = readOnlySequence.IsSingleSegment ? readOnlySequence.First.Span : readOnlySequence.ToArray().AsSpan(); + //results.Add(Encoding.UTF8.GetString(span)); + + byte[] buffer = readOnlySequence.IsSingleSegment ? readOnlySequence.First.Span.ToArray() : readOnlySequence.ToArray(); + results.Add(Encoding.UTF8.GetString(buffer)); + } + } +} diff --git a/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj b/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj index 0c5e3ebf..cbdf4ec1 100644 --- a/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj +++ b/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj @@ -17,6 +17,7 @@ + diff --git a/Samples/Sample.AspNetCore.WebApi.sln b/Samples/Sample.AspNetCore.WebApi.sln new file mode 100644 index 00000000..376a5591 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi.sln @@ -0,0 +1,59 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31702.278 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore.WebApi", "Sample.AspNetCore.WebApi\Sample.AspNetCore.WebApi.csproj", "{02BF092F-3E0C-4021-8252-C54EE0E0FD91}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar", "..\Rollbar\Rollbar.csproj", "{BA457CE8-500C-43C3-BC29-C18E63F635B6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.NetPlatformExtensions", "..\Rollbar.NetPlatformExtensions\Rollbar.NetPlatformExtensions.csproj", "{9C97FB02-7689-488E-9DA1-DE55098DF64F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.NetCore.AspNet", "..\Rollbar.NetCore.AspNet\Rollbar.NetCore.AspNet.csproj", "{5775BFF8-8106-4FD8-A6B8-25605CDC1DF8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RollbarSDK", "RollbarSDK", "{E7749628-2B00-4E17-9EAD-0206ED797317}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Instrumented|Any CPU = Instrumented|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {02BF092F-3E0C-4021-8252-C54EE0E0FD91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02BF092F-3E0C-4021-8252-C54EE0E0FD91}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02BF092F-3E0C-4021-8252-C54EE0E0FD91}.Instrumented|Any CPU.ActiveCfg = Release|Any CPU + {02BF092F-3E0C-4021-8252-C54EE0E0FD91}.Instrumented|Any CPU.Build.0 = Release|Any CPU + {02BF092F-3E0C-4021-8252-C54EE0E0FD91}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02BF092F-3E0C-4021-8252-C54EE0E0FD91}.Release|Any CPU.Build.0 = Release|Any CPU + {BA457CE8-500C-43C3-BC29-C18E63F635B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA457CE8-500C-43C3-BC29-C18E63F635B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA457CE8-500C-43C3-BC29-C18E63F635B6}.Instrumented|Any CPU.ActiveCfg = Instrumented|Any CPU + {BA457CE8-500C-43C3-BC29-C18E63F635B6}.Instrumented|Any CPU.Build.0 = Instrumented|Any CPU + {BA457CE8-500C-43C3-BC29-C18E63F635B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA457CE8-500C-43C3-BC29-C18E63F635B6}.Release|Any CPU.Build.0 = Release|Any CPU + {9C97FB02-7689-488E-9DA1-DE55098DF64F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C97FB02-7689-488E-9DA1-DE55098DF64F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C97FB02-7689-488E-9DA1-DE55098DF64F}.Instrumented|Any CPU.ActiveCfg = Debug|Any CPU + {9C97FB02-7689-488E-9DA1-DE55098DF64F}.Instrumented|Any CPU.Build.0 = Debug|Any CPU + {9C97FB02-7689-488E-9DA1-DE55098DF64F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C97FB02-7689-488E-9DA1-DE55098DF64F}.Release|Any CPU.Build.0 = Release|Any CPU + {5775BFF8-8106-4FD8-A6B8-25605CDC1DF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5775BFF8-8106-4FD8-A6B8-25605CDC1DF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5775BFF8-8106-4FD8-A6B8-25605CDC1DF8}.Instrumented|Any CPU.ActiveCfg = Debug|Any CPU + {5775BFF8-8106-4FD8-A6B8-25605CDC1DF8}.Instrumented|Any CPU.Build.0 = Debug|Any CPU + {5775BFF8-8106-4FD8-A6B8-25605CDC1DF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5775BFF8-8106-4FD8-A6B8-25605CDC1DF8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {BA457CE8-500C-43C3-BC29-C18E63F635B6} = {E7749628-2B00-4E17-9EAD-0206ED797317} + {9C97FB02-7689-488E-9DA1-DE55098DF64F} = {E7749628-2B00-4E17-9EAD-0206ED797317} + {5775BFF8-8106-4FD8-A6B8-25605CDC1DF8} = {E7749628-2B00-4E17-9EAD-0206ED797317} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {19367D10-E231-4C01-A135-2693B615813A} + EndGlobalSection +EndGlobal diff --git a/Samples/Sample.AspNetCore.WebApi/Controllers/WeatherForecastController.cs b/Samples/Sample.AspNetCore.WebApi/Controllers/WeatherForecastController.cs new file mode 100644 index 00000000..1fcde5c0 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/Controllers/WeatherForecastController.cs @@ -0,0 +1,85 @@ +namespace Sample.AspNetCore.WebApi.Controllers +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + + using Microsoft.AspNetCore.Mvc; + using Microsoft.Extensions.Logging; + + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + this._logger.LogInformation(nameof(WeatherForecastController) + $" is created."); + } + + [HttpGet] + public IEnumerable Get() + { + this._logger.LogInformation(nameof(WeatherForecastController) + $".Get() is called."); + + var rng = new Random(); + int id = 0; + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + ID = ++id, + Date = DateTime.Now.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }).ToArray(); + } + + [HttpGet("{id}")] + public ActionResult GetByID(int id) + { + this._logger.LogInformation(nameof(WeatherForecastController) + $".GetByID(int id) is called."); + + var rng = new Random(); + var record = new WeatherForecast + { + ID = id, + Date = DateTime.Now.AddDays(id), + TemperatureC = (2 * id), + Summary = Summaries[rng.Next(Summaries.Length)] + }; + + var result = Ok(record); + this._logger.LogInformation(nameof(WeatherForecastController) + $".GetByID(...) executed with result: {result}."); + + return result; + } + + // POST api/values + [HttpPost] + public void Post([FromBody] string value) + { + this._logger.LogInformation(nameof(WeatherForecastController) + $".Post(...) is called with body."); + //throw new Exception("AspNetCore2.WebApi sample: Unhandled exception within the ValueController.Post(...)"); + } + + // PUT api/values/5 + [HttpPut("{id}")] + public void Put(int id, [FromBody] string value) + { + } + + // DELETE api/values/5 + [HttpDelete("{id}")] + public void Delete(int id) + { + } + + } +} diff --git a/Samples/Sample.AspNetCore.WebApi/Program.cs b/Samples/Sample.AspNetCore.WebApi/Program.cs new file mode 100644 index 00000000..33cfd211 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/Program.cs @@ -0,0 +1,27 @@ +namespace Sample.AspNetCore.WebApi +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + + using Microsoft.AspNetCore.Hosting; + using Microsoft.Extensions.Configuration; + using Microsoft.Extensions.Hosting; + using Microsoft.Extensions.Logging; + + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/Samples/Sample.AspNetCore.WebApi/Properties/launchSettings.json b/Samples/Sample.AspNetCore.WebApi/Properties/launchSettings.json new file mode 100644 index 00000000..21983989 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:22403", + "sslPort": 44332 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Sample.AspNetCore.WebApi": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Samples/Sample.AspNetCore.WebApi/Sample.AspNetCore.WebApi.csproj b/Samples/Sample.AspNetCore.WebApi/Sample.AspNetCore.WebApi.csproj new file mode 100644 index 00000000..897c06df --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/Sample.AspNetCore.WebApi.csproj @@ -0,0 +1,21 @@ + + + + net5.0 + + + + + + + + + + + + + + + + + diff --git a/Samples/Sample.AspNetCore.WebApi/Startup.cs b/Samples/Sample.AspNetCore.WebApi/Startup.cs new file mode 100644 index 00000000..dcd9b2f7 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/Startup.cs @@ -0,0 +1,138 @@ +namespace Sample.AspNetCore.WebApi +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + + using Microsoft.AspNetCore.Builder; + using Microsoft.AspNetCore.Hosting; + using Microsoft.AspNetCore.Http; + using Microsoft.AspNetCore.HttpsPolicy; + using Microsoft.AspNetCore.Mvc; + using Microsoft.Extensions.Configuration; + using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Hosting; + using Microsoft.Extensions.Logging; + using Microsoft.OpenApi.Models; + + using Rollbar; + using Rollbar.NetCore.AspNet; + + using Samples; + + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration + { + get; + } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddSingleton(); + + ConfigureRollbarSingleton(); + + services.AddRollbarLogger(loggerOptions => + { + loggerOptions.Filter = (loggerName, loglevel) => loglevel >= LogLevel.Information; + }); + + services.AddControllers(); + services.AddSwaggerGen(c => + { + c.SwaggerDoc("v1", new OpenApiInfo { Title = "Sample.AspNetCore.WebApi", Version = "v1" }); + }); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if(env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Sample.AspNetCore.WebApi v1")); + } + + app.UseRollbarMiddleware(); + + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + + /// + /// Configures the Rollbar singleton-like notifier. + /// + private void ConfigureRollbarSingleton() + { + RollbarInfrastructureConfig config = new RollbarInfrastructureConfig( + RollbarSamplesSettings.AccessToken, + RollbarSamplesSettings.Environment + ); + config.RollbarLoggerConfig.RollbarDeveloperOptions.LogLevel = ErrorLevel.Debug; + config.RollbarInfrastructureOptions.MaxItems = 500; + //RollbarDataSecurityOptions dataSecurityOptions = new RollbarDataSecurityOptions(); + //dataSecurityOptions.ScrubFields = new string[] + //{ + // "url", + // "method", + //}; + //config.RollbarLoggerConfig.RollbarDataSecurityOptions.Reconfigure(dataSecurityOptions); + + RollbarInfrastructure.Instance.Init(config); + RollbarInfrastructure.Instance.QueueController.InternalEvent += OnRollbarInternalEvent; + } + + /// + /// Called when Rollbar internal event detected. + /// + /// The sender. + /// The instance containing the event data. + private static void OnRollbarInternalEvent(object sender, RollbarEventArgs e) + { + Console.WriteLine(e.TraceAsString()); + + RollbarApiErrorEventArgs apiErrorEvent = e as RollbarApiErrorEventArgs; + if(apiErrorEvent != null) + { + //TODO: handle/report Rollbar API communication error event... + return; + } + CommunicationEventArgs commEvent = e as CommunicationEventArgs; + if(commEvent != null) + { + //TODO: handle/report Rollbar API communication event... + return; + } + CommunicationErrorEventArgs commErrorEvent = e as CommunicationErrorEventArgs; + if(commErrorEvent != null) + { + //TODO: handle/report basic communication error while attempting to reach Rollbar API service... + return; + } + InternalErrorEventArgs internalErrorEvent = e as InternalErrorEventArgs; + if(internalErrorEvent != null) + { + //TODO: handle/report basic internal error while using the Rollbar Notifier... + return; + } + } + + } +} diff --git a/Samples/Sample.AspNetCore.WebApi/WeatherForecast.cs b/Samples/Sample.AspNetCore.WebApi/WeatherForecast.cs new file mode 100644 index 00000000..4bb16ca0 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/WeatherForecast.cs @@ -0,0 +1,29 @@ +namespace Sample.AspNetCore.WebApi +{ + using System; + + public class WeatherForecast + { + public int ID + { + get; set; + } + + public DateTime Date + { + get; set; + } + + public int TemperatureC + { + get; set; + } + + public int TemperatureF => 32 + (int) (TemperatureC / 0.5556); + + public string Summary + { + get; set; + } + } +} diff --git a/Samples/Sample.AspNetCore.WebApi/appsettings.Development.json b/Samples/Sample.AspNetCore.WebApi/appsettings.Development.json new file mode 100644 index 00000000..63ed6e14 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/Samples/Sample.AspNetCore.WebApi/appsettings.json b/Samples/Sample.AspNetCore.WebApi/appsettings.json new file mode 100644 index 00000000..214d63f9 --- /dev/null +++ b/Samples/Sample.AspNetCore.WebApi/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs b/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs index 81eb6106..089ff47a 100644 --- a/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs +++ b/Samples/Sample.AspNetCore2.WebApi/Controllers/ValuesController.cs @@ -96,7 +96,10 @@ public ActionResult GetByID(int id) Timestamp = DateTime.Now }; - return Ok(record); + var result = Ok(record); + this._logger.LogTrace(nameof(ValuesController) + $".GetByID(...) executed with result: {result}."); + + return result; } private void FakeExceptionCallStack(ref int level) @@ -117,7 +120,7 @@ private void Rollbar_InternalEvent(object sender, Rollbar.RollbarEventArgs e) [HttpPost] public void Post([FromBody]string value) { - this._logger.LogTrace(nameof(ValuesController) + $".Post(...) is called with bod."); + this._logger.LogTrace(nameof(ValuesController) + $".Post(...) is called with body."); //throw new Exception("AspNetCore2.WebApi sample: Unhandled exception within the ValueController.Post(...)"); } diff --git a/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj b/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj index 7f36a537..b0a52050 100644 --- a/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj +++ b/Samples/Sample.AspNetCore2.WebApi/Sample.AspNetCore2.WebApi.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + netcoreapp2.2 diff --git a/Samples/Sample.AspNetCore2.WebApi/Startup.cs b/Samples/Sample.AspNetCore2.WebApi/Startup.cs index 9c55cf8c..063135e1 100644 --- a/Samples/Sample.AspNetCore2.WebApi/Startup.cs +++ b/Samples/Sample.AspNetCore2.WebApi/Startup.cs @@ -33,10 +33,10 @@ public void ConfigureServices(IServiceCollection services) //{"Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'. To use 'IApplicationBuilder.UseMvc' set 'MvcOptions.EnableEndpointRouting = false' inside 'ConfigureServices(...)."} services.AddMvc(options => options.EnableEndpointRouting = false); services.AddOptions(); - services.Configure(options => - { - options.AllowSynchronousIO = true; - }); + //services.Configure(options => + //{ + // options.AllowSynchronousIO = true; + //}); services.AddSingleton(); From 538c1b12dc58d3de031fa89f0283f2c390d5e015 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Tue, 28 Sep 2021 23:05:34 -0700 Subject: [PATCH 3/8] WIP: cleaning target frameworks --- Benchmarker.Common/Benchmarker.Common.csproj | 5 +++-- Benchmarker.Common/BenchmarksConfig.cs | 4 +++- .../Rollbar.AppSettings.Json.csproj | 3 ++- Rollbar.Deploys/Rollbar.Deploys.csproj | 3 ++- .../Rollbar.Net.AspNet.Mvc.csproj | 3 ++- .../Rollbar.Net.AspNet.WebApi.csproj | 3 ++- Rollbar.Net.AspNet/Rollbar.Net.AspNet.csproj | 3 ++- .../Rollbar.NetCore.AspNet.csproj | 18 ++++++++++------- Rollbar.NetCore.AspNet/RollbarMiddleware.cs | 4 ---- .../Rollbar.NetPlatformExtensions.csproj | 4 +++- .../PayloadStore/StoreContext.cs | 2 +- .../Rollbar.OfflinePersistence.csproj | 12 +++++++++-- .../Rollbar.PlugIns.Log4net.csproj | 3 ++- ...Rollbar.PlugIns.MSEnterpriseLibrary.csproj | 3 ++- .../Rollbar.PlugIns.NLog.csproj | 3 ++- .../Rollbar.PlugIns.Serilog.csproj | 3 ++- Rollbar.sln | 13 ++++-------- Rollbar/Rollbar.csproj | 6 +++--- Samples/Sample.AspNetCore.WebApp.sln | 20 +++++++++++++++++-- ...Scaffold.Rollbar.OfflinePersistence.csproj | 1 + SdkCommon.csproj | 1 + .../UnitTest.Rollbar.App.Config.csproj | 2 +- .../UnitTest.Rollbar.AppSettings.Json.csproj | 2 +- .../UnitTest.Rollbar.Deploys.csproj | 7 ++++--- .../UnitTest.Rollbar.Net.AspNet.Mvc.csproj | 2 +- .../UnitTest.Rollbar.Net.AspNet.WebApi.csproj | 2 +- ...tTest.Rollbar.NetPlatformExtensions.csproj | 4 ++-- ...UnitTest.Rollbar.OfflinePersistence.csproj | 4 ++-- .../UnitTest.Rollbar.PlugIns.Log4net.csproj | 4 ++-- ...Rollbar.PlugIns.MSEnterpriseLibrary.csproj | 4 ++-- .../UnitTest.Rollbar.PlugIns.NLog.csproj | 4 ++-- .../UnitTest.Rollbar.PlugIns.Serilog.csproj | 4 ++-- UnitTest.Rollbar/UnitTest.Rollbar.csproj | 10 +++++----- 33 files changed, 101 insertions(+), 65 deletions(-) diff --git a/Benchmarker.Common/Benchmarker.Common.csproj b/Benchmarker.Common/Benchmarker.Common.csproj index 30b8a546..f2873e11 100644 --- a/Benchmarker.Common/Benchmarker.Common.csproj +++ b/Benchmarker.Common/Benchmarker.Common.csproj @@ -7,12 +7,13 @@ - netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;net48;net472;net471;net47;net462;net461;netstandard2.1;netstandard2.0 + netstandard2.0 AnyCPU + true - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Benchmarker.Common/BenchmarksConfig.cs b/Benchmarker.Common/BenchmarksConfig.cs index f9513690..d4b17de4 100644 --- a/Benchmarker.Common/BenchmarksConfig.cs +++ b/Benchmarker.Common/BenchmarksConfig.cs @@ -2,9 +2,11 @@ { using BenchmarkDotNet.Configs; using BenchmarkDotNet.Environments; - using BenchmarkDotNet.Horology; + //using BenchmarkDotNet.Horology; using BenchmarkDotNet.Jobs; + using Perfolizer.Horology; + public class BenchmarksConfig : ManualConfig { public BenchmarksConfig() diff --git a/Rollbar.AppSettings.Json/Rollbar.AppSettings.Json.csproj b/Rollbar.AppSettings.Json/Rollbar.AppSettings.Json.csproj index 61da0d98..49babc5b 100644 --- a/Rollbar.AppSettings.Json/Rollbar.AppSettings.Json.csproj +++ b/Rollbar.AppSettings.Json/Rollbar.AppSettings.Json.csproj @@ -1,10 +1,11 @@ - + netstandard2.0 Rollbar.AppSettings.Json Rollbar.AppSettings.Json + true diff --git a/Rollbar.Deploys/Rollbar.Deploys.csproj b/Rollbar.Deploys/Rollbar.Deploys.csproj index 9b689600..8b6a9f8b 100644 --- a/Rollbar.Deploys/Rollbar.Deploys.csproj +++ b/Rollbar.Deploys/Rollbar.Deploys.csproj @@ -1,9 +1,10 @@ - netstandard2.1;netstandard2.0 + netstandard2.0 Rollbar.Deploys Rollbar.Deploys + true diff --git a/Rollbar.Net.AspNet.Mvc/Rollbar.Net.AspNet.Mvc.csproj b/Rollbar.Net.AspNet.Mvc/Rollbar.Net.AspNet.Mvc.csproj index 097e0342..6ea508dc 100644 --- a/Rollbar.Net.AspNet.Mvc/Rollbar.Net.AspNet.Mvc.csproj +++ b/Rollbar.Net.AspNet.Mvc/Rollbar.Net.AspNet.Mvc.csproj @@ -1,10 +1,11 @@  - net48;net472;net471;net47;net462;net461;net46;net452;net451 + net48;net472;net471;net47;net462;net461;net46;net452 Rollbar.Net.AspNet.Mvc Rollbar.Net.AspNet.Mvc + true diff --git a/Rollbar.Net.AspNet.WebApi/Rollbar.Net.AspNet.WebApi.csproj b/Rollbar.Net.AspNet.WebApi/Rollbar.Net.AspNet.WebApi.csproj index de223e2a..5cc812f4 100644 --- a/Rollbar.Net.AspNet.WebApi/Rollbar.Net.AspNet.WebApi.csproj +++ b/Rollbar.Net.AspNet.WebApi/Rollbar.Net.AspNet.WebApi.csproj @@ -1,9 +1,10 @@  - net48;net472;net471;net47;net462;net461;net46;net452;net451 + net48;net472;net471;net47;net462;net461;net46;net452 Rollbar.Net.AspNet.WebApi Rollbar.Net.AspNet.WebApi + true diff --git a/Rollbar.Net.AspNet/Rollbar.Net.AspNet.csproj b/Rollbar.Net.AspNet/Rollbar.Net.AspNet.csproj index 185bb16f..804cf8a0 100644 --- a/Rollbar.Net.AspNet/Rollbar.Net.AspNet.csproj +++ b/Rollbar.Net.AspNet/Rollbar.Net.AspNet.csproj @@ -1,10 +1,11 @@  - net48;net472;net471;net47;net462;net461;net46;net452;net451 + net48;net472;net471;net47;net462;net461;net46;net452 Rollbar.Net.AspNet Rollbar.Net.AspNet + true diff --git a/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj b/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj index 1fff7fb1..37da9470 100644 --- a/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj +++ b/Rollbar.NetCore.AspNet/Rollbar.NetCore.AspNet.csproj @@ -1,9 +1,11 @@  - netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;netstandard2.1;netstandard2.0 + net5.0;netcoreapp3.1 + Rollbar.NetCore.AspNet Rollbar.NetCore.AspNet + true @@ -21,9 +23,11 @@ + + - + + + diff --git a/Rollbar.NetCore.AspNet/RollbarMiddleware.cs b/Rollbar.NetCore.AspNet/RollbarMiddleware.cs index db4b7f02..8ae84cec 100644 --- a/Rollbar.NetCore.AspNet/RollbarMiddleware.cs +++ b/Rollbar.NetCore.AspNet/RollbarMiddleware.cs @@ -92,11 +92,7 @@ public async Task Invoke(HttpContext? context) .Get()? .TraceIdentifier; -#if(NETSTANDARD_2_0 || NETCORE_2_0) - context?.Request.EnableRewind(); // so that we can rewind the body stream once we are done -#else context?.Request.EnableBuffering(); // so that we can rewind the body stream once we are done -#endif using(_logger.BeginScope($"Request: {requestId ?? string.Empty}")) { diff --git a/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj b/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj index cbdf4ec1..bd1c5535 100644 --- a/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj +++ b/Rollbar.NetPlatformExtensions/Rollbar.NetPlatformExtensions.csproj @@ -1,9 +1,11 @@  - netstandard2.1;netstandard2.0 + netstandard2.0 + Rollbar.NetPlatformExtensions Rollbar.NetPlatformExtensions + true diff --git a/Rollbar.OfflinePersistence/PayloadStore/StoreContext.cs b/Rollbar.OfflinePersistence/PayloadStore/StoreContext.cs index 505e9c11..9e051f7e 100644 --- a/Rollbar.OfflinePersistence/PayloadStore/StoreContext.cs +++ b/Rollbar.OfflinePersistence/PayloadStore/StoreContext.cs @@ -2,7 +2,7 @@ { using Microsoft.EntityFrameworkCore; - using Rollbar.Common; + //using Rollbar.Common; /// /// Class StoreContext. diff --git a/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj b/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj index 980e4e0a..d9f9248d 100644 --- a/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj +++ b/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj @@ -1,7 +1,8 @@  - netstandard2.0;net5.0;net48;net472;net471;net47;net462;net461 + net5.0;net48;net472;net471;net47;net462;net461;netstandard2.0 + Rollbar.OfflinePersistence Rollbar.OfflinePersistence Debug;Release;Instrumented @@ -19,7 +20,14 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Rollbar.PlugIns.Log4net/Rollbar.PlugIns.Log4net.csproj b/Rollbar.PlugIns.Log4net/Rollbar.PlugIns.Log4net.csproj index a722e3c2..26987e88 100644 --- a/Rollbar.PlugIns.Log4net/Rollbar.PlugIns.Log4net.csproj +++ b/Rollbar.PlugIns.Log4net/Rollbar.PlugIns.Log4net.csproj @@ -1,9 +1,10 @@  - netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;net472;net471;net47;net462;net461;net46;net452;net451;netstandard2.1;netstandard2.0 + netstandard2.0 Rollbar.PlugIns.Log4net Rollbar.PlugIns.Log4net + true diff --git a/Rollbar.PlugIns.MSEnterpriseLibrary/Rollbar.PlugIns.MSEnterpriseLibrary.csproj b/Rollbar.PlugIns.MSEnterpriseLibrary/Rollbar.PlugIns.MSEnterpriseLibrary.csproj index 253c7585..09a4e84b 100644 --- a/Rollbar.PlugIns.MSEnterpriseLibrary/Rollbar.PlugIns.MSEnterpriseLibrary.csproj +++ b/Rollbar.PlugIns.MSEnterpriseLibrary/Rollbar.PlugIns.MSEnterpriseLibrary.csproj @@ -1,9 +1,10 @@  - net461 + netstandard2.0 Rollbar.PlugIns.MSEnterpriseLibrary Rollbar.PlugIns.MSEnterpriseLibrary + true diff --git a/Rollbar.PlugIns.NLog/Rollbar.PlugIns.NLog.csproj b/Rollbar.PlugIns.NLog/Rollbar.PlugIns.NLog.csproj index 35439616..311768d7 100644 --- a/Rollbar.PlugIns.NLog/Rollbar.PlugIns.NLog.csproj +++ b/Rollbar.PlugIns.NLog/Rollbar.PlugIns.NLog.csproj @@ -1,9 +1,10 @@  - netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;net472;net471;net47;net462;net461;net46;net452;net451;netstandard2.1;netstandard2.0 + netstandard2.0 Rollbar.PlugIns.NLog Rollbar.PlugIns.NLog + true diff --git a/Rollbar.PlugIns.Serilog/Rollbar.PlugIns.Serilog.csproj b/Rollbar.PlugIns.Serilog/Rollbar.PlugIns.Serilog.csproj index 6d32db31..f57557d9 100644 --- a/Rollbar.PlugIns.Serilog/Rollbar.PlugIns.Serilog.csproj +++ b/Rollbar.PlugIns.Serilog/Rollbar.PlugIns.Serilog.csproj @@ -1,9 +1,10 @@  - netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;net472;net471;net47;net462;net461;net46;net452;net451;netstandard2.1;netstandard2.0 + netstandard2.0 Rollbar.PlugIns.Serilog Rollbar.PlugIns.Serilog + true diff --git a/Rollbar.sln b/Rollbar.sln index 16766808..40a8cd2a 100644 --- a/Rollbar.sln +++ b/Rollbar.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30002.166 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31717.71 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{3635FA93-6994-4CE4-9923-BF330DF1A439}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3635FA93-6994-4CE4-9923-BF330DF1A439}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig azure-pipelines.yml = azure-pipelines.yml @@ -66,11 +66,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.OfflinePersistence" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest.Rollbar.OfflinePersistence", "UnitTest.Rollbar.OfflinePersistence\UnitTest.Rollbar.OfflinePersistence.csproj", "{777762CD-FD2D-438C-A04B-A18EFA8D59ED}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0643BD3F-61CE-461A-B5E6-FA2EB983F8DD}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.AppSettings.Json", "Rollbar.AppSettings.Json\Rollbar.AppSettings.Json.csproj", "{8BA2905B-73F9-40B9-8508-76B7E0DC3C56}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.App.Config", "Rollbar.App.Config\Rollbar.App.Config.csproj", "{8CA46207-E937-4C6F-9FA5-1C94E044FEEB}" @@ -79,7 +74,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest.Rollbar.App.Config EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest.Rollbar.AppSettings.Json", "UnitTest.Rollbar.AppSettings.Json\UnitTest.Rollbar.AppSettings.Json.csproj", "{6045888B-A63F-4FE7-8001-7C21171329B0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scaffold.Rollbar.OfflinePersistence", "Scaffold.Rollbar.OfflinePersistence\Scaffold.Rollbar.OfflinePersistence.csproj", "{3F0A5FDF-DFCE-4527-A64C-0CBE59608C4C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Scaffold.Rollbar.OfflinePersistence", "Scaffold.Rollbar.OfflinePersistence\Scaffold.Rollbar.OfflinePersistence.csproj", "{3F0A5FDF-DFCE-4527-A64C-0CBE59608C4C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Rollbar/Rollbar.csproj b/Rollbar/Rollbar.csproj index a454790f..47c50ca1 100644 --- a/Rollbar/Rollbar.csproj +++ b/Rollbar/Rollbar.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;net48;net472;net471;net47;net462;net461;net46;net452;net451;netstandard2.1;netstandard2.0 + net5.0;netcoreapp3.1;net48;net472;net471;net47;net462;net461;net46;net452;netstandard2.0 Rollbar Rollbar @@ -38,7 +38,7 @@ - + NET_CORE $(DefineConstants);NETCOREAPP @@ -79,7 +79,7 @@ - + diff --git a/Samples/Sample.AspNetCore.WebApp.sln b/Samples/Sample.AspNetCore.WebApp.sln index 76dc0524..8a5814f1 100644 --- a/Samples/Sample.AspNetCore.WebApp.sln +++ b/Samples/Sample.AspNetCore.WebApp.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31624.102 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31717.71 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AspNetCore.WebApp", "Sample.AspNetCore.WebApp\Sample.AspNetCore.WebApp.csproj", "{7EE8717B-57EE-4A88-8911-9C7F9BD12D0F}" EndProject @@ -11,6 +11,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.NetPlatformExtensio EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.NetCore.AspNet", "..\Rollbar.NetCore.AspNet\Rollbar.NetCore.AspNet.csproj", "{7C624B7A-FF72-41C1-AA37-550CDC854052}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rollbar.AppSettings.Json", "..\Rollbar.AppSettings.Json\Rollbar.AppSettings.Json.csproj", "{885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RollbarSDK", "RollbarSDK", "{A1BA1864-5185-4EB1-90F9-08BFA07F8847}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -42,10 +46,22 @@ Global {7C624B7A-FF72-41C1-AA37-550CDC854052}.Instrumented|Any CPU.Build.0 = Debug|Any CPU {7C624B7A-FF72-41C1-AA37-550CDC854052}.Release|Any CPU.ActiveCfg = Release|Any CPU {7C624B7A-FF72-41C1-AA37-550CDC854052}.Release|Any CPU.Build.0 = Release|Any CPU + {885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8}.Instrumented|Any CPU.ActiveCfg = Debug|Any CPU + {885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8}.Instrumented|Any CPU.Build.0 = Debug|Any CPU + {885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {986DCA00-6906-4422-8875-82BCC64FE2A1} = {A1BA1864-5185-4EB1-90F9-08BFA07F8847} + {E8808A9C-10E9-4045-A8E2-D95A3B57A91A} = {A1BA1864-5185-4EB1-90F9-08BFA07F8847} + {7C624B7A-FF72-41C1-AA37-550CDC854052} = {A1BA1864-5185-4EB1-90F9-08BFA07F8847} + {885F4C6A-3F5E-4676-9DA0-F33E8B7A1CC8} = {A1BA1864-5185-4EB1-90F9-08BFA07F8847} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4EFA9B57-5984-4F0F-8F39-8A019A27CFB5} EndGlobalSection diff --git a/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj b/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj index 6a0a6b54..bbcc10fd 100644 --- a/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj +++ b/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj @@ -3,6 +3,7 @@ Exe net5.0 + true diff --git a/SdkCommon.csproj b/SdkCommon.csproj index c0954ea7..cb8c41a5 100644 --- a/SdkCommon.csproj +++ b/SdkCommon.csproj @@ -11,6 +11,7 @@ true bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml true + true diff --git a/UnitTest.Rollbar.App.Config/UnitTest.Rollbar.App.Config.csproj b/UnitTest.Rollbar.App.Config/UnitTest.Rollbar.App.Config.csproj index 24f89d79..0854d670 100644 --- a/UnitTest.Rollbar.App.Config/UnitTest.Rollbar.App.Config.csproj +++ b/UnitTest.Rollbar.App.Config/UnitTest.Rollbar.App.Config.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net5.0;netcoreapp3.1;net48;net472;net462 false diff --git a/UnitTest.Rollbar.AppSettings.Json/UnitTest.Rollbar.AppSettings.Json.csproj b/UnitTest.Rollbar.AppSettings.Json/UnitTest.Rollbar.AppSettings.Json.csproj index 42385c6d..52541b4b 100644 --- a/UnitTest.Rollbar.AppSettings.Json/UnitTest.Rollbar.AppSettings.Json.csproj +++ b/UnitTest.Rollbar.AppSettings.Json/UnitTest.Rollbar.AppSettings.Json.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0;netcoreapp3.1;net48;net472;net462 false diff --git a/UnitTest.Rollbar.Deploys/UnitTest.Rollbar.Deploys.csproj b/UnitTest.Rollbar.Deploys/UnitTest.Rollbar.Deploys.csproj index 69919d39..67956222 100644 --- a/UnitTest.Rollbar.Deploys/UnitTest.Rollbar.Deploys.csproj +++ b/UnitTest.Rollbar.Deploys/UnitTest.Rollbar.Deploys.csproj @@ -1,4 +1,4 @@ - + latest @@ -6,7 +6,7 @@ - netcoreapp3.1;netcoreapp2.1 + net5.0;netcoreapp3.1;net48;net472;net462 false @@ -16,9 +16,10 @@ - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/UnitTest.Rollbar.Net.AspNet.Mvc/UnitTest.Rollbar.Net.AspNet.Mvc.csproj b/UnitTest.Rollbar.Net.AspNet.Mvc/UnitTest.Rollbar.Net.AspNet.Mvc.csproj index e514b721..034e0c07 100644 --- a/UnitTest.Rollbar.Net.AspNet.Mvc/UnitTest.Rollbar.Net.AspNet.Mvc.csproj +++ b/UnitTest.Rollbar.Net.AspNet.Mvc/UnitTest.Rollbar.Net.AspNet.Mvc.csproj @@ -16,7 +16,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/UnitTest.Rollbar.Net.AspNet.WebApi/UnitTest.Rollbar.Net.AspNet.WebApi.csproj b/UnitTest.Rollbar.Net.AspNet.WebApi/UnitTest.Rollbar.Net.AspNet.WebApi.csproj index d211aa4f..09c70997 100644 --- a/UnitTest.Rollbar.Net.AspNet.WebApi/UnitTest.Rollbar.Net.AspNet.WebApi.csproj +++ b/UnitTest.Rollbar.Net.AspNet.WebApi/UnitTest.Rollbar.Net.AspNet.WebApi.csproj @@ -16,7 +16,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/UnitTest.Rollbar.NetPlatformExtensions/UnitTest.Rollbar.NetPlatformExtensions.csproj b/UnitTest.Rollbar.NetPlatformExtensions/UnitTest.Rollbar.NetPlatformExtensions.csproj index 3d96a40f..44e6c6d4 100644 --- a/UnitTest.Rollbar.NetPlatformExtensions/UnitTest.Rollbar.NetPlatformExtensions.csproj +++ b/UnitTest.Rollbar.NetPlatformExtensions/UnitTest.Rollbar.NetPlatformExtensions.csproj @@ -6,7 +6,7 @@ - netcoreapp3.1;netcoreapp2.1 + net5.0;netcoreapp3.1;net48;net472;net462 false @@ -15,7 +15,7 @@ - + diff --git a/UnitTest.Rollbar.OfflinePersistence/UnitTest.Rollbar.OfflinePersistence.csproj b/UnitTest.Rollbar.OfflinePersistence/UnitTest.Rollbar.OfflinePersistence.csproj index 547ca011..675939d4 100644 --- a/UnitTest.Rollbar.OfflinePersistence/UnitTest.Rollbar.OfflinePersistence.csproj +++ b/UnitTest.Rollbar.OfflinePersistence/UnitTest.Rollbar.OfflinePersistence.csproj @@ -6,14 +6,14 @@ - net5.0;netcoreapp3.1;netcoreapp2.1;net48;net472;net471;net47;net462;net461 + net5.0;netcoreapp3.1;net48;net472;net471;net47;net462;net461 false Debug;Release;Instrumented true - + INSTRUMENT diff --git a/UnitTest.Rollbar.PlugIns.Log4net/UnitTest.Rollbar.PlugIns.Log4net.csproj b/UnitTest.Rollbar.PlugIns.Log4net/UnitTest.Rollbar.PlugIns.Log4net.csproj index 00982f7e..256ae729 100644 --- a/UnitTest.Rollbar.PlugIns.Log4net/UnitTest.Rollbar.PlugIns.Log4net.csproj +++ b/UnitTest.Rollbar.PlugIns.Log4net/UnitTest.Rollbar.PlugIns.Log4net.csproj @@ -5,7 +5,7 @@ - netcoreapp3.1;netcoreapp2.1;net48;net472;net462 + net5.0;netcoreapp3.1;net48;net472;net462 false @@ -16,7 +16,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary.csproj b/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary.csproj index 2cfca2b0..4310e821 100644 --- a/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary.csproj +++ b/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary/UnitTest.Rollbar.PlugIns.MSEnterpriseLibrary.csproj @@ -5,7 +5,7 @@ - net461 + net5.0;netcoreapp3.1;net48;net472;net462;net461 true false @@ -22,7 +22,7 @@ - + diff --git a/UnitTest.Rollbar.PlugIns.NLog/UnitTest.Rollbar.PlugIns.NLog.csproj b/UnitTest.Rollbar.PlugIns.NLog/UnitTest.Rollbar.PlugIns.NLog.csproj index 65e5cc5f..67025269 100644 --- a/UnitTest.Rollbar.PlugIns.NLog/UnitTest.Rollbar.PlugIns.NLog.csproj +++ b/UnitTest.Rollbar.PlugIns.NLog/UnitTest.Rollbar.PlugIns.NLog.csproj @@ -5,7 +5,7 @@ - netcoreapp3.1;netcoreapp2.1;net48;net472;net462 + net5.0;netcoreapp3.1;net48;net472;net462 false @@ -16,7 +16,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/UnitTest.Rollbar.PlugIns.Serilog/UnitTest.Rollbar.PlugIns.Serilog.csproj b/UnitTest.Rollbar.PlugIns.Serilog/UnitTest.Rollbar.PlugIns.Serilog.csproj index de04dd3f..14d0cd7e 100644 --- a/UnitTest.Rollbar.PlugIns.Serilog/UnitTest.Rollbar.PlugIns.Serilog.csproj +++ b/UnitTest.Rollbar.PlugIns.Serilog/UnitTest.Rollbar.PlugIns.Serilog.csproj @@ -5,7 +5,7 @@ - netcoreapp3.1;netcoreapp2.1;net48;net472;net462 + net5.0;netcoreapp3.1;net48;net472;net462 false @@ -16,7 +16,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/UnitTest.Rollbar/UnitTest.Rollbar.csproj b/UnitTest.Rollbar/UnitTest.Rollbar.csproj index d97d8d1d..f71f3b86 100644 --- a/UnitTest.Rollbar/UnitTest.Rollbar.csproj +++ b/UnitTest.Rollbar/UnitTest.Rollbar.csproj @@ -6,14 +6,14 @@ - netcoreapp3.1;netcoreapp2.1;net48;net472;net462 + net5.0;netcoreapp3.1;net48;net472;net462 false Debug;Release;Instrumented true - - + + INSTRUMENT @@ -23,7 +23,7 @@ NETSTANDARD - + NET_CORE NETCOREAPP @@ -39,7 +39,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + From 4daf6571402cf0322f4592489814b27b05ea1ce5 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 29 Sep 2021 01:16:39 -0700 Subject: [PATCH 4/8] WIP: fixing OfflinePersistence build --- .../Rollbar.OfflinePersistence.csproj | 18 ++++++------------ .../Scaffold.Rollbar.OfflinePersistence.csproj | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj b/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj index d9f9248d..2b44abe7 100644 --- a/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj +++ b/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj @@ -1,7 +1,8 @@ - + - net5.0;net48;net472;net471;net47;net462;net461;netstandard2.0 + netstandard2.0 + Rollbar.OfflinePersistence Rollbar.OfflinePersistence @@ -20,17 +21,10 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj b/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj index bbcc10fd..28c5ccc2 100644 --- a/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj +++ b/Scaffold.Rollbar.OfflinePersistence/Scaffold.Rollbar.OfflinePersistence.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 18d95f9877f20ec9c5724d44fc48b812e8842d43 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 29 Sep 2021 21:49:02 -0700 Subject: [PATCH 5/8] updated OfflinePersistence dependencies --- .../Rollbar.OfflinePersistence.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj b/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj index 2b44abe7..d6537322 100644 --- a/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj +++ b/Rollbar.OfflinePersistence/Rollbar.OfflinePersistence.csproj @@ -21,10 +21,10 @@ - - - - + + + all + none From 550781ab6f0eec8a0f7e2dfc2fba8a805f4d8824 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 29 Sep 2021 21:49:44 -0700 Subject: [PATCH 6/8] updated the version and the release notes --- SdkCommon.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SdkCommon.csproj b/SdkCommon.csproj index cb8c41a5..bd2c4c7f 100644 --- a/SdkCommon.csproj +++ b/SdkCommon.csproj @@ -24,14 +24,14 @@ - 5.0.2 + 5.0.3 beta false - - feat: resolve #532 - Make RollbarMiddlewareException wrapper optional based on config settings - - feat: resolve #408 - Invalid configuration file prototype error - - refactor: resolve #587 - Update Rollbar.NET's dependency on Newtonsoft.Json package to current version 13.0 - - docs: updated README.md + - feat: resolve #585 - Would like to have an ability to log HttpRequest Body via ILogger + - refactor: clean up the SDK explicit targets to only currently supported .NET versions + - fix: OfflinePersistence module's dependency on sqlite native bits +