Skip to content

Commit

Permalink
Removed Portable Package (PCL) support (#227)
Browse files Browse the repository at this point in the history
* Removed Portable Package (PCL) support
  • Loading branch information
niemyjski authored Mar 17, 2020
1 parent 7a9d3a6 commit a3e0977
Show file tree
Hide file tree
Showing 37 changed files with 94 additions and 841 deletions.
70 changes: 0 additions & 70 deletions src/Exceptionless.Portable/Exceptionless.Portable.csproj

This file was deleted.

1 change: 0 additions & 1 deletion src/Exceptionless.Portable/readme.txt

This file was deleted.

8 changes: 3 additions & 5 deletions src/Exceptionless/Configuration/CertificateData.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if !PORTABLE && !NETSTANDARD1_2
using System.Net.Http;
using System.Net.Http;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;

Expand Down Expand Up @@ -45,12 +44,11 @@ private CertificateData(X509Chain chain, SslPolicyErrors sslPolicyErrors) {
public object Sender { get; }
#endif

#if !NET45 && !PORTABLE && !NETSTANDARD1_2
#if !NET45
/// <summary>
/// The request which was sent to the remore party
/// </summary>
public HttpRequestMessage Request { get; }
#endif
}
}
#endif
}
42 changes: 3 additions & 39 deletions src/Exceptionless/Configuration/ExceptionlessConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
#if !PORTABLE
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand All @@ -20,14 +18,9 @@ public class ExceptionlessConfiguration {
private const string DEFAULT_HEARTBEAT_SERVER_URL = "https://heartbeat.exceptionless.io";
private const string DEFAULT_USER_AGENT = "exceptionless/";
private static readonly Lazy<string> _version = new Lazy<string>(() => {
#if !PORTABLE
var assembly = Assembly.GetExecutingAssembly();
var attribute = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>();
return attribute.Version;
#else
// NOTE: This is hard coded for a single release. The next release will deprecate portable.
return "4.4.0.0";
#endif
});
private const int DEFAULT_SUBMISSION_BATCH_SIZE = 50;

Expand Down Expand Up @@ -167,7 +160,7 @@ public string ApiKey {
/// Whether the client is currently enabled or not. If it is disabled, submitted errors will be discarded and no data will be sent to the server.
/// </summary>
public bool Enabled { get; set; }

/// <summary>
/// Maximum time (provided in days) that the queue will persist events
/// </summary>
Expand All @@ -194,7 +187,7 @@ public string ApiKey {
public SettingsDictionary Settings { get; private set; }

/// <summary>
/// How often the client should check for updated server settings when idle. The default is every 2 minutes.
/// How often the client should check for updated server settings when idle. The default is every 2 minutes.
/// </summary>
public TimeSpan? UpdateSettingsWhenIdleInterval {
get { return _updateSettingsWhenIdleInterval; }
Expand Down Expand Up @@ -287,12 +280,10 @@ public int SubmissionBatchSize {
}
}

#if !PORTABLE && !NETSTANDARD1_2
/// <summary>
/// Callback which is invoked to validate the exceptionless server certificate.
/// </summary>
public Func<CertificateData, bool> ServerCertificateValidationCallback { get; set; }
#endif

/// <summary>
/// A list of exclusion patterns that will automatically remove any data that matches them from any data submitted to the server.
Expand Down Expand Up @@ -372,11 +363,7 @@ public void AddEventExclusion(Func<Event, bool> eventExclusionCallback) {

#region Plugins

#if !PORTABLE
private readonly ConcurrentDictionary<string, PluginRegistration> _plugins = new ConcurrentDictionary<string, PluginRegistration>();
#else
private readonly Dictionary<string, PluginRegistration> _plugins = new Dictionary<string, PluginRegistration>();
#endif

/// <summary>
/// The list of plugins that will be used in this configuration.
Expand All @@ -394,12 +381,8 @@ public void AddPlugin<T>(T plugin) where T : IEventPlugin {
string key = typeof(T).FullName;
RemovePlugin(key);

#if !PORTABLE
if (!_plugins.TryAdd(key, new PluginRegistration(key, GetPriority(typeof(T)), new Lazy<IEventPlugin>(() => plugin))))
Resolver.GetLog().Error(String.Format("Unable to add plugin: {0}", key));
#else
_plugins[key] = new PluginRegistration(key, GetPriority(typeof(T)), new Lazy<IEventPlugin>(() => plugin));
#endif
}

/// <summary>
Expand All @@ -419,12 +402,8 @@ public void AddPlugin(string key, Type pluginType) {
RemovePlugin(key);

var plugin = new PluginRegistration(key, GetPriority(pluginType), new Lazy<IEventPlugin>(() => Resolver.Resolve(pluginType) as IEventPlugin));
#if !PORTABLE
if (!_plugins.TryAdd(key, plugin))
Resolver.GetLog().Error(String.Format("Unable to add plugin: {0}", key));
#else
_plugins[key] = plugin;
#endif
}

/// <summary>
Expand All @@ -446,12 +425,8 @@ public void AddPlugin(string key, int priority, Func<ExceptionlessConfiguration,
RemovePlugin(key);

var plugin = new PluginRegistration(key, priority, new Lazy<IEventPlugin>(() => factory(this)));
#if !PORTABLE
if (!_plugins.TryAdd(key, plugin))
Resolver.GetLog().Error(String.Format("Unable to add plugin: {0}", key));
#else
_plugins[key] = plugin;
#endif
}

/// <summary>
Expand Down Expand Up @@ -479,14 +454,10 @@ public void AddPlugin(string key, Action<EventPluginContext> pluginAction) {
/// <param name="pluginAction">The plugin action to run.</param>
public void AddPlugin(string key, int priority, Action<EventPluginContext> pluginAction) {
RemovePlugin(key);

var plugin = new PluginRegistration(key, priority, new Lazy<IEventPlugin>(() => new ActionPlugin(pluginAction)));
#if !PORTABLE
if (!_plugins.TryAdd(key, plugin))
Resolver.GetLog().Error(String.Format("Unable to add plugin: {0}", key));
#else
_plugins[key] = plugin;
#endif
}

/// <summary>
Expand All @@ -502,16 +473,9 @@ public void RemovePlugin<T>() where T : IEventPlugin {
/// </summary>
/// <param name="key">The key for the plugin to be removed.</param>
public void RemovePlugin(string key) {
#if !PORTABLE
PluginRegistration plugin;
if (_plugins.TryRemove(key, out plugin))
plugin.Dispose();
#else
if (_plugins.ContainsKey(key)) {
_plugins[key].Dispose();
_plugins.Remove(key);
}
#endif
}

private int GetPriority(Type type) {
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptionless/Configuration/ExceptionlessSection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !PORTABLE && !NETSTANDARD
#if !NETSTANDARD
using System;
using System.ComponentModel;
using System.Configuration;
Expand All @@ -10,7 +10,7 @@ internal class ExceptionlessSection : ConfigurationSection {

[ConfigurationProperty("apiKey", IsRequired = true)]
public string ApiKey { get { return base["apiKey"] as string; } set { base["apiKey"] = value; } }

[ConfigurationProperty("serverUrl")]
public string ServerUrl { get { return base["serverUrl"] as string; } set { base["serverUrl"] = value; } }

Expand Down
47 changes: 2 additions & 45 deletions src/Exceptionless/Exceptionless.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netstandard2.0;portable46-net451+win81+wpa81;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
<PackageId>Exceptionless</PackageId>
<AssemblyName>Exceptionless</AssemblyName>
<AssemblyTitle>Exceptionless client for non visual (ie. Console and Services) applications.</AssemblyTitle>
<Description>Exceptionless client for portable applications. $(Description)</Description>
<PackageTags>Exceptionless;Error;Report;Reporting;Exception;Logging;Log;ELMAH;pcl;NETSTANDARD;Core</PackageTags>
<PackageTags>Exceptionless;Error;Report;Reporting;Exception;Logging;Log;ELMAH;NETSTANDARD;Core</PackageTags>
</PropertyGroup>

<ItemGroup Label="Package">
Expand All @@ -39,48 +38,6 @@
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'portable46-net451+win81+wpa81'" Label="Build">
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile151</TargetFrameworkProfile>
<DefineConstants>$(DefineConstants);PORTABLE</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'portable46-net451+win81+wpa81'" Label="Framework References">
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Collections" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Dynamic.Runtime" />
<Reference Include="System.Globalization" />
<Reference Include="System.IO" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Linq" />
<Reference Include="System.Linq.Expressions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Primitives" />
<Reference Include="System.ObjectModel" />
<Reference Include="System.Reflection" />
<Reference Include="System.Reflection.Extensions" />
<Reference Include="System.Reflection.Primitives" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Runtime.Serialization.Primitives" />
<Reference Include="System.Text.Encoding" />
<Reference Include="System.Text.Encoding.Extensions" />
<Reference Include="System.Text.RegularExpressions" />
<Reference Include="System.Threading" />
<Reference Include="System.Threading.Tasks" />
<Reference Include="System.Threading.Timer" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml.ReaderWriter" />
<Reference Include="System.Xml.XDocument" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net45'" Label="Build">
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
</PropertyGroup>
Expand Down
5 changes: 0 additions & 5 deletions src/Exceptionless/Extensions/EventBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using Exceptionless.Models.Data;

#if !PORTABLE && !NETSTANDARD1_2
using Exceptionless.Plugins.Default;
#endif

namespace Exceptionless {
public static class EventBuilderExtensions {
Expand Down Expand Up @@ -102,7 +99,6 @@ public static EventBuilder SetManualStackingKey(this EventBuilder builder, strin
return builder;
}

#if !PORTABLE && !NETSTANDARD1_2
/// <summary>
/// Adds the recent trace log entries to the event.
/// </summary>
Expand All @@ -113,6 +109,5 @@ public static EventBuilder AddRecentTraceLogEntries(this EventBuilder builder, D
TraceLogPlugin.AddRecentTraceLogEntries(builder.Target, listener, maxEntriesToInclude);
return builder;
}
#endif
}
}
9 changes: 0 additions & 9 deletions src/Exceptionless/Extensions/ExceptionlessClientExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@ public static void Startup(this ExceptionlessClient client, string apiKey = null
client.Configuration.ApiKey = apiKey;

client.Configuration.ReadAllConfig();

#if !PORTABLE && !NETSTANDARD1_2
client.Configuration.UseTraceLogEntriesPlugin();
#endif

if (client.Configuration.UpdateSettingsWhenIdleInterval == null)
client.Configuration.UpdateSettingsWhenIdleInterval = TimeSpan.FromMinutes(2);

#if !PORTABLE && !NETSTANDARD1_2
client.RegisterAppDomainUnhandledExceptionHandler();

// make sure that queued events are sent when the app exits
client.RegisterOnProcessExitHandler();
#endif
client.RegisterTaskSchedulerUnobservedTaskExceptionHandler();

if (client.Configuration.SessionsEnabled)
Expand All @@ -51,10 +46,8 @@ public static void Shutdown(this ExceptionlessClient client) {
if (client == null)
throw new ArgumentNullException(nameof(client));

#if !PORTABLE && !NETSTANDARD1_2
client.UnregisterAppDomainUnhandledExceptionHandler();
client.UnregisterOnProcessExitHandler();
#endif
client.UnregisterTaskSchedulerUnobservedTaskExceptionHandler();

client.ProcessQueue();
Expand Down Expand Up @@ -349,7 +342,6 @@ public static void SubmitSessionHeartbeat(this ExceptionlessClient client, strin

namespace Exceptionless.Extensions {
public static class ExceptionlessClientExtensions {
#if !PORTABLE && !NETSTANDARD1_2
private static UnhandledExceptionEventHandler _onAppDomainUnhandledException;
public static void RegisterAppDomainUnhandledExceptionHandler(this ExceptionlessClient client) {
if (client == null)
Expand Down Expand Up @@ -426,7 +418,6 @@ public static void UnregisterOnProcessExitHandler(this ExceptionlessClient clien
AppDomain.CurrentDomain.ProcessExit -= _onProcessExit;
_onProcessExit = null;
}
#endif

private static EventHandler<UnobservedTaskExceptionEventArgs> _onTaskSchedulerOnUnobservedTaskException;
public static void RegisterTaskSchedulerUnobservedTaskExceptionHandler(this ExceptionlessClient client) {
Expand Down
Loading

0 comments on commit a3e0977

Please sign in to comment.