Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

FluentMap File Load Exception with Dapper 1.50.7 #83

Closed
jmalczak opened this issue Feb 18, 2019 · 10 comments
Closed

FluentMap File Load Exception with Dapper 1.50.7 #83

jmalczak opened this issue Feb 18, 2019 · 10 comments
Assignees
Labels
Milestone

Comments

@jmalczak
Copy link

Hi. Following test app throws file load exception on .net core 2.2

using Dapper.FluentMap;
using Dapper.FluentMap.Mapping;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            FluentMapper.Initialize(c =>
            {
                c.AddMap(new TestMap());
            });
        }
    }

    public class Test
    {
        public string TestField { get; set; }
    }

    public class TestMap : EntityMap<Test>
    {
        public TestMap()
        {
            Map(p => p.TestField).ToColumn("Test");
        }
    }
}

With following package references

  <ItemGroup>
    <PackageReference Include="Dapper" Version="1.50.7" />
    <PackageReference Include="Dapper.FluentMap" Version="1.7.0" />
  </ItemGroup>
@henkmollema
Copy link
Owner

Can you provide a stack trace?

@jmalczak
Copy link
Author

Hi

Sorry for the late reply. Here are exception details including stack trace:

System.IO.FileLoadException
  HResult=0x80131040
  Message=Could not load file or assembly 'Dapper, Version=1.50.5.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=Dapper.FluentMap
  StackTrace:
   at Dapper.FluentMap.FluentMapper.AddTypeMap[TEntity]()
   at ConsoleApp1.Program.<>c.<Main>b__0_0(FluentMapConfiguration c) in C:\Users\malczu\source\repos\ConsoleApp1\Program.cs:line 12
   at ConsoleApp1.Program.Main(String[] args) in C:\Users\malczu\source\repos\ConsoleApp1\Program.cs:line 10

@henkmollema
Copy link
Owner

Is there a reason you explicitly need v1.50.7? What happens if you remove <PackageReference Include="Dapper" Version="1.50.7" /> from the project file.

@jmalczak
Copy link
Author

No I don't need it to be honest. When I either remove dapper as separate dependency and use only transitive dependency via FluentMap. Or keep it as separate dependency and downgrade to 1.50.5 it works fine. But I saw requirement Dapper (>= 1.50.5) during nuget install which is kind of correct for 1.50.7.

Thanks

@henkmollema
Copy link
Owner

Thanks for the investigation. Obviously it should just work. I'll try to get a repro on my machine.

@jmalczak
Copy link
Author

No problem, thanks for the library. If you will figure out what is wrong, that it doesn't work by default, please put a note here.

Thanks again!

@maoxian-1
Copy link

I also encountered the same problem on .net framework 4.5.2

@jarrettv
Copy link

jarrettv commented Mar 8, 2019

Dapper fixed this problem in the latest 1.60.1 version

@SIkebe
Copy link

SIkebe commented Mar 19, 2019

Dapper fixed this problem in the latest 1.60.1 version

I've confirmed this issue fixed with Dapper v1.60.1, too.

@henkmollema henkmollema self-assigned this Mar 28, 2019
@henkmollema henkmollema added this to the v1.8 milestone Mar 28, 2019
@henkmollema
Copy link
Owner

Dapper.FluentMap v1.8 is release with the updated Dapper package.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants