Skip to content

Commit

Permalink
Adding support to Xamarin/Mono. Fix incompatible calls to `System.Run…
Browse files Browse the repository at this point in the history
…time.InteropServices.Marshal`. (#180)
  • Loading branch information
thepirat000 committed Nov 16, 2018
1 parent c5f4cde commit fcdd1ed
Show file tree
Hide file tree
Showing 28 changed files with 50 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,10 @@ All notable changes to Audit.NET and its extensions will be documented in this f

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [13.3.0] - 2018-11-16
### Modified
- Audit.Core: Adding support to Xamarin/Mono. Fix incompatible calls to `System.Runtime.InteropServices.Marshal`. (#180)

## [13.2.2] - 2018-11-15
### Modified
- Audit.EntityFramework.Core: Fix bug when auditing tables with composite multiple froeign keys related to the same column (#178).
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.DynamicProxy/Audit.DynamicProxy.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate Audit Logs by intercepting operation calls on any class without changing its code.</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.DynamicProxy</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
Expand Up @@ -4,7 +4,7 @@
<Description>Generate Audit Logs from EntityFramework context changes</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.EntityFramework.Core</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;netstandard2.0;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
Expand Up @@ -4,7 +4,7 @@
<Description>Generate Audit Logs from EntityFramework identity context changes</Description>
<Copyright>Copyright 2018</Copyright>
<AssemblyTitle>Audit.EntityFramework.Identity.Core</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;netstandard2.0;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
Expand Up @@ -4,7 +4,7 @@
<Description>Generate Audit Logs from EntityFramework identity context changes</Description>
<Copyright>Copyright 2018</Copyright>
<AssemblyTitle>Audit.EntityFramework.Identity</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;netstandard2.0;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.EntityFramework/Audit.EntityFramework.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate Audit Logs from EntityFramework context changes</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.EntityFramework</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;netstandard2.0;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.FileSystem/Audit.FileSystem.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate Audit Logs from file system events using a FileSystemWatcher</Description>
<Copyright>Copyright 2018</Copyright>
<AssemblyTitle>Audit.FileSystem</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.Mvc.Core/Audit.Mvc.Core.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate detailed Audit Logs for AspNet Core MVC Controller actions.</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.Mvc.Core</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.6;netstandard2.0;net451</TargetFrameworks>
<DefineConstants>TRACE;DEBUG;STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.Mvc/Audit.Mvc.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate detailed Audit Logs for MVC Controller actions.</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.Mvc</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.6;netstandard2.0;net45</TargetFrameworks>
<DefineConstants>TRACE;DEBUG;STRONG_NAME</DefineConstants>
Expand Down
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Trail Logs into an Azure Document DB database</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.AzureDocumentDB</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>net45;netstandard1.6;netstandard2.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.AzureStorage/Audit.NET.AzureStorage.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Logs into an Azure Blob Storage</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.AzureStorage</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.DynamoDB/Audit.NET.DynamoDB.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Trail Logs into Amazon DynamoDB</Description>
<Copyright>Copyright 2018</Copyright>
<AssemblyTitle>Audit.DynamoDB</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.ElasticSearch/Audit.NET.Elasticsearch.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Trail Logs into Elasticsearch database</Description>
<Copyright>Copyright 2018</Copyright>
<AssemblyTitle>Audit.Elasticsearch</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.EventLog.Core/Audit.NET.EventLog.Core.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Log Audit.NET events to the Windows EventLog when targeting net standard 2.0</Description>
<Copyright>Copyright 2018</Copyright>
<AssemblyTitle>Audit.NET.EventLog.Core</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.MongoDB/Audit.NET.MongoDB.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Trail Logs into a MongoDB database</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.MongoDB</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;net45</TargetFrameworks>
<NoWarn>$(NoWarn);1591</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.MySql/Audit.NET.MySql.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Trail Logs into a MySQL database</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.MySql</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netcoreapp1.0;net451</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.PostgreSql/Audit.NET.PostgreSql.csproj
Expand Up @@ -3,7 +3,7 @@
<Description>Store Audit.NET Trail Logs into a PostgreSQL database</Description>
<Copyright>Copyright 2017</Copyright>
<AssemblyTitle>Audit.PostgreSql</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard2.0;netstandard1.3;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.Redis/Audit.NET.Redis.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Trail Logs in a Redis database as a strings, lists, hashes, sortedsets or pubsub</Description>
<Copyright>Copyright 2017</Copyright>
<AssemblyTitle>Audit.Redis</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.SqlServer/Audit.NET.SqlServer.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Store Audit.NET Trail Logs into a SQL Server database</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.SqlServer</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard2.0;netstandard1.3;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.Udp/Audit.NET.Udp.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Send Audit.NET Trail Logs as connectionless UDP datagrams to a remote host or a multicast group</Description>
<Copyright>Copyright 2017</Copyright>
<AssemblyTitle>Audit.Udp</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET.log4net/Audit.NET.log4net.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Log Audit.NET Audit Trail using Apache log4net™</Description>
<Copyright>Copyright 2017</Copyright>
<AssemblyTitle>Audit.log4net</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.NET/Audit.NET.csproj
Expand Up @@ -3,7 +3,7 @@
<Description>An extensible framework to audit executing operations in .NET and .NET Core.</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.NET</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.3;netstandard2.0;net45</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
5 changes: 5 additions & 0 deletions src/Audit.NET/AuditScope.cs
Expand Up @@ -367,6 +367,11 @@ private void EndEvent()
private static Exception GetCurrentException()
{
#pragma warning disable CS0618 // Type or member is obsolete
if (PlatformHelper.IsRunningOnMono())
{
// Mono doesn't implement Marshal.GetExceptionCode() (https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs#L521)
return null;
}
if (Marshal.GetExceptionCode() != 0)
{
return Marshal.GetExceptionForHR(Marshal.GetExceptionCode());
Expand Down
16 changes: 16 additions & 0 deletions src/Audit.NET/PlatformHelper.cs
@@ -0,0 +1,16 @@
using System;

namespace Audit.Core
{
internal static class PlatformHelper
{
private static readonly Lazy<bool> IsRunningOnMonoValue = new Lazy<bool>(() =>
{
return Type.GetType("Mono.Runtime") != null;
});
public static bool IsRunningOnMono()
{
return IsRunningOnMonoValue.Value;
}
}
}
2 changes: 1 addition & 1 deletion src/Audit.SignalR/Audit.SignalR.csproj
Expand Up @@ -3,7 +3,7 @@
<Description>Generate Audit Logs for ASP.NET SignalR invokations</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.SignalR</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFramework>net45</TargetFramework>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.WCF/Audit.WCF.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate detailed Audit Logs for WCF service calls.</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.Wcf</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFramework>net45</TargetFramework>
<DefineConstants>$(DefineConstants);STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.WebApi.Core/Audit.WebApi.Core.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate detailed Audit Logs for AspNet Core Web API Controller calls.</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.WebApi.Core</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.6;netstandard2.0;net451</TargetFrameworks>
<DefineConstants>TRACE;DEBUG;STRONG_NAME</DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion src/Audit.WebApi/Audit.WebApi.csproj
Expand Up @@ -4,7 +4,7 @@
<Description>Generate detailed Audit Logs for Web API Controller calls.</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.WebApi</AssemblyTitle>
<VersionPrefix>13.2.2</VersionPrefix>
<VersionPrefix>13.3.0</VersionPrefix>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.6;netstandard2.0;net45</TargetFrameworks>
<DefineConstants>TRACE;DEBUG;STRONG_NAME</DefineConstants>
Expand Down

0 comments on commit fcdd1ed

Please sign in to comment.