Giter VIP home page Giter VIP logo

Comments (19)

RehanSaeed avatar RehanSaeed commented on June 9, 2024 1

The ground has shifted again.

netstandard 2.0 will add support for Mono. If we target that, then Mono support will be assured and we won't have to do reflection in SqlExceptionDestructurer. I say we wait for official Mono support.

Also, by then xproj to csproj will be complete, and the Tooling bug stopping our Travis CI builds from successfully running xUnit tests on Mono will be fixed.

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

Thanks for posting this. There is no P/Invoke in Serilog.Exceptions.

Probably this is caused by ExceptionDestructurer because it contains a list of all the exceptions with just the default Exception properties. One of the Exception types in that long list may not be supported on Mono?

Unfortunately, the exception you posted does not list which type is causing the problem. If you would like to test this, you can grab the Serilog.Exceptions project and try debugging it directly, rather than using the NuGet package.

from serilog.exceptions.

MattAlex151 avatar MattAlex151 commented on June 9, 2024

Hey thanks! I'm trying to compile from source on Linux, and I'm running in to some issues there too. I have to run now so I figured I'd post my progress to see if it shed some more light. First, I had:

/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Serilog.Exceptions.xproj: error : /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Serilog.Exceptions.xproj: /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Serilog.Exceptions.xproj could not import "$(VSToolsPath)\DNX\Microsoft.DNX.Props"

So I found the following post: travis-ci/travis-ci#5164 and followed the instructions here: travis-ci/travis-ci#5164 (comment)

So now I try to build your project.json file, with the following result:

Microsoft .NET Development Utility Mono-x64-1.0.0-rc1-16609
Building . for .NETFramework,Version=v4.0

Using Project dependency . 1.1.0
Source: /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json

Using Package dependency Serilog 1.5.14
Source: /home/matt/.dnx/packages/Serilog/1.5.14
File: lib/net40/Serilog.dll
File: lib/net40/Serilog.FullNetFx.dll

Using Assembly dependency fx/System 4.0.0
Source: /usr/lib/mono/4.0/System.dll

Using Assembly dependency fx/System.Core 4.0.0
Source: /usr/lib/mono/4.0/System.Core.dll

Using Assembly dependency fx/System.Data 4.0.0
Source: /usr/lib/mono/4.0/System.Data.dll

Unable to resolve dependency fx/System.Runtime

Using Assembly dependency fx/mscorlib 4.0.0
Source: /usr/lib/mono/4.0/mscorlib.dll

Using Assembly dependency fx/Microsoft.CSharp 4.0.0
Source: /usr/lib/mono/4.0/Microsoft.CSharp.dll

/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(28,27): error NU1001: The dependency fx/System.Runtime could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(56,51): .NETFramework,Version=v4.0 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(57,51): .NETFramework,Version=v4.0 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(58,51): .NETFramework,Version=v4.0 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(59,51): .NETFramework,Version=v4.0 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(85,39): .NETFramework,Version=v4.0 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(86,39): .NETFramework,Version=v4.0 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(87,39): .NETFramework,Version=v4.0 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)

Building . for .NETFramework,Version=v4.5
Using Project dependency . 1.1.0
Source: /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json

Using Package dependency Serilog 1.5.14
Source: /home/matt/.dnx/packages/Serilog/1.5.14
File: lib/net45/Serilog.dll
File: lib/net45/Serilog.FullNetFx.dll

Using Assembly dependency fx/System 4.0.0
Source: /usr/lib/mono/4.5/System.dll

Using Assembly dependency fx/System.Core 4.0.0
Source: /usr/lib/mono/4.5/System.Core.dll

Using Assembly dependency fx/System.Data 4.0.0
Source: /usr/lib/mono/4.5/System.Data.dll

Using Assembly dependency fx/System.Runtime 4.0.0
Source: /usr/lib/mono/4.5/Facades/System.Runtime.dll

Using Assembly dependency fx/mscorlib 4.0.0
Source: /usr/lib/mono/4.5/mscorlib.dll

Using Assembly dependency fx/Microsoft.CSharp 4.0.0
Source: /usr/lib/mono/4.5/Microsoft.CSharp.dll

/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(56,51): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(57,51): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(58,51): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(59,51): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(61,59): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'EventSourceException' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(85,39): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(86,39): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(87,39): .NETFramework,Version=v4.5 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/SqlExceptionDestructurer.cs(24,42): .NETFramework,Version=v4.5 error CS0117: 'SqlException' does not contain a definition for 'ClientConnectionId'
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/SqlExceptionDestructurer.cs(24,76): .NETFramework,Version=v4.5 error CS1061: 'SqlException' does not contain a definition for 'ClientConnectionId' and no extension method 'ClientConnectionId' accepting a first argument of type 'SqlException' could be found (are you missing a using directive or an assembly reference?)

Building . for .NETFramework,Version=v4.5.1
Using Project dependency . 1.1.0
Source: /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json

Using Package dependency Serilog 1.5.14
Source: /home/matt/.dnx/packages/Serilog/1.5.14
File: lib/net45/Serilog.dll
File: lib/net45/Serilog.FullNetFx.dll

Using Assembly dependency fx/System 4.0.0
Source: /usr/lib/mono/4.5/System.dll

Using Assembly dependency fx/System.Core 4.0.0
Source: /usr/lib/mono/4.5/System.Core.dll

Using Assembly dependency fx/System.Data 4.0.0
Source: /usr/lib/mono/4.5/System.Data.dll

Using Assembly dependency fx/System.Runtime 4.0.0
Source: /usr/lib/mono/4.5/Facades/System.Runtime.dll

Using Assembly dependency fx/mscorlib 4.0.0
Source: /usr/lib/mono/4.5/mscorlib.dll

Using Assembly dependency fx/Microsoft.CSharp 4.0.0
Source: /usr/lib/mono/4.5/Microsoft.CSharp.dll

/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(56,51): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(57,51): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(58,51): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(59,51): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'Eventing' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(61,59): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'EventSourceException' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(85,39): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(86,39): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/ExceptionDestructurer.cs(87,39): .NETFramework,Version=v4.5.1 error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?)
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/SqlExceptionDestructurer.cs(24,42): .NETFramework,Version=v4.5.1 error CS0117: 'SqlException' does not contain a definition for 'ClientConnectionId'
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/Destructurers/SqlExceptionDestructurer.cs(24,76): .NETFramework,Version=v4.5.1 error CS1061: 'SqlException' does not contain a definition for 'ClientConnectionId' and no extension method 'ClientConnectionId' accepting a first argument of type 'SqlException' could be found (are you missing a using directive or an assembly reference?)

Building . for .NETFramework,Version=v4.5.2
Using Project dependency . 1.1.0
Source: /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json

Using Package dependency Serilog 1.5.14
Source: /home/matt/.dnx/packages/Serilog/1.5.14
File: lib/net45/Serilog.dll
File: lib/net45/Serilog.FullNetFx.dll

Unable to resolve dependency fx/System

Unable to resolve dependency fx/System.Core

Unable to resolve dependency fx/System.Data

Unable to resolve dependency fx/System.Runtime

Unable to resolve dependency fx/mscorlib

Unable to resolve dependency fx/Microsoft.CSharp

/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/System could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/System.Core could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(60,24): error NU1001: The dependency fx/System.Data could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(61,27): error NU1001: The dependency fx/System.Runtime could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/mscorlib could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/Microsoft.CSharp could not be resolved.
error CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.

Building . for .NETFramework,Version=v4.6
Using Project dependency . 1.1.0
Source: /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json

Using Package dependency Serilog 1.5.14
Source: /home/matt/.dnx/packages/Serilog/1.5.14
File: lib/net45/Serilog.dll
File: lib/net45/Serilog.FullNetFx.dll

Unable to resolve dependency fx/System

Unable to resolve dependency fx/System.Core

Unable to resolve dependency fx/System.Data

Unable to resolve dependency fx/System.Runtime

Unable to resolve dependency fx/mscorlib

Unable to resolve dependency fx/Microsoft.CSharp

/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/System could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/System.Core could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(71,24): error NU1001: The dependency fx/System.Data could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(72,27): error NU1001: The dependency fx/System.Runtime could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/mscorlib could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/Microsoft.CSharp could not be resolved.
error CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.

Building . for .NETFramework,Version=v4.6.1
Using Project dependency . 1.1.0
Source: /home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json

Using Package dependency Serilog 1.5.14
Source: /home/matt/.dnx/packages/Serilog/1.5.14
File: lib/net45/Serilog.dll
File: lib/net45/Serilog.FullNetFx.dll

Unable to resolve dependency fx/System

Unable to resolve dependency fx/System.Core

Unable to resolve dependency fx/System.Data

Unable to resolve dependency fx/System.Runtime

Unable to resolve dependency fx/mscorlib

Unable to resolve dependency fx/Microsoft.CSharp

/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/System could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/System.Core could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(82,24): error NU1001: The dependency fx/System.Data could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(83,27): error NU1001: The dependency fx/System.Runtime could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/mscorlib could not be resolved.
/home/matt/serilog/Serilog.Exceptions/Source/Serilog.Exceptions/project.json(0,0): error NU1001: The dependency fx/Microsoft.CSharp could not be resolved.
error CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.

Build failed.
0 Warning(s)
49 Error(s)

Time elapsed 00:00:01.8116590
Total build time elapsed: 00:00:01.8360651
Total projects built: 1

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

Feel free to reopen if you need me to do anything.

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

So after some search it seems that the following exceptions can't be loaded on Mono:

  • System.Diagnostics.Eventing.Reader.EventLogInvalidDataException
  • System.Diagnostics.Eventing.Reader.EventLogNotFoundException
  • System.Diagnostics.Eventing.Reader.EventLogProviderDisabledException
  • System.Diagnostics.Eventing.Reader.EventLogReadingException
  • System.Management.Instrumentation.InstanceNotFoundException
  • System.Management.Instrumentation.InstrumentationBaseException
  • System.Management.Instrumentation.InstrumentationException

They are all from System.Core which I think is in Mono 4.0, but I think that these types aren't part of Mono for now.

Is it possible to exclude them on Mono?

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

I'm not sure. Presumably we could use a pre-processor directive but I'm not sure how to do this in the new project.json world. Any ideas?

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

I am not sure this is possible.
But following the netstandard mapping to platforms, if you add another target to netstandard1.2 mono should be covered.

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

Have you tested that? Would you be willing to submit a PR for the above?

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

I haven't, I am not at all familiar with netstandard.

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

So I've tried but ended with nothing, this was a dead-end: System.Core isn't supported by any netstandard targets.
And after some though I don't think having a mono target can help: for example my application target .NET 4.5, which is supposed to be largely compatible with mono, so when the build is fetching the nuget Serilog.Exceptions package, it's the net45 which is referenced no matter what.

So I think that the only solutions until Mono supports these types are modification in applications/libraries wich reference Serilog.Exceptions:

  • define a MONO pre-processor directive which exclude the call to Enrich.WithExceptions().
  • override the destructurers and not include the ExceptionDestructurer, but define a new one which includes only types compatible with all platforms.

Sorry for the bothering.

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

Thanks to http://apisof.net I can confirm that these types are only available in the full .NET Framework.

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

Perhaps we could check if these types exist in the assemblies and only add them if they do?

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

Excellent idea! 😄
I was so focused on pre-processor directive that I haven't think of that.

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

@laedit So I created a Travis build here but it's failing. The errors suggest that there are other types not supported on Mono. Is this correct?

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

Strange, the 'EventSourceException' should have fail my test.
Apisof.net confirm that it doesn't exists on Mono.
I will look into it tomorrow, I can't do it right now.

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

Cool, looks like it was worth investing in Travis CI.

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

Yes, that was an excellent idea 😄

I have tested the use of the new version of Serilog.Exceptions on a Travis build and it passed.
The difference is that I always install the latest version of mono and in your config you specified the version 4.2.3.

So if you want to support that specific version, I will add EventSourceException and SqlException to the types not handled by mono.

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 9, 2024

I just tried 4.4.2 here and according to this thats the latest release version. Still failed.

from serilog.exceptions.

laedit avatar laedit commented on June 9, 2024

Ok, so I honestly don't know why it is working on my test project.
Nevertheless, I will test all types with apisof.net to see if there are other that I missed.

from serilog.exceptions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.