NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
859 stars 170 forks source link

FileNotFoundException in ASP.NET Core and netstandard (possibly caused by Dapper dependency) #162

Closed florinciubotariu closed 5 years ago

florinciubotariu commented 5 years ago

Hello. I've tried to add Exceptional into an existing solution but it seems there may be some problems regarding Dapper's version.

A short description of my solution (taking away unnecessary details):

Dependencies:

The following error is shown in the Output tab when an exception is trying to be logged: System.IO.FileNotFoundException: Could not load file or assembly 'Dapper, Version=1.50.2.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. File name: 'Dapper, Version=1.50.2.0, Culture=neutral, PublicKeyToken=null' at StackExchange.Exceptional.Stores.SQLErrorStore.LogError(Error error) at StackExchange.Exceptional.ErrorStore.TestAsync() in C:\projects\stackexchange-exceptional\src\StackExchange.Exceptional.Shared\ErrorStore.cs:line 520

Workaround:

In project B, downgrade Dapper to 1.50.2.

I think the same would happen if you have two projects with a dependency between them (A -> Dapper 1.50.7, B -> StackExchange.Exceptional.AspNetCore 2.0)

I'm not sure if the problem is indeed in Exceptional, but any articles that explains why the issue appears here would be nice (the majority of the articles are referring to .NET Framework).

NickCraver commented 5 years ago

I'm want to close this out here but not because you're wrong...the problem is indeed Dapper (I'm also a Dapper maintainer - hi!). Specifically, on .NET Core where the binding is a bit different. An assembly version locking scheme went sideways due to a release for the locked version not landing as intended until later in our push. I've bumped the version of the lock in 1.60.x.

If you are willing to try a custom feed, I'd really appreciate you trying https://www.myget.org/feed/dapper/package/nuget/Dapper and getting 1.60.1 and seeing if it solves your binding issue. If it does, I'll get latest Dapper out to NuGet and unlist the problematic pinned releases there.

Any chance you're in a position to try this? I'm happy to help as able, just ping away.

florinciubotariu commented 5 years ago

Hi @NickCraver! I've installed Dapper v1.60.1 and the issue is indeed fixed. No more binding issues are appearing.

Unrelated: Thank you and your team. I really appreciate your work for the community.

NickCraver commented 5 years ago

@florinciubotariu thanks a ton for testing that out and confirming! The 1.60.1 release is processing on NuGet now and you can remove the custom feed shortly :)