Forum Xamarin.Android

Could not load file or assembly 'System.ServiceModel.Web, Version=2.0.5.0...

When using the servicestack.dll I get with the 4.7.11 Xamarin.Android the following error at runtime:

Could not load file or assembly 'System.ServiceModel.Web, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
This happens ONLY when Linking is set to "Sdk Assemblies Only". If the linker is off erverything works perfect. With version 4.6.x it worked with and without linker.

I also tried to exclude (skip) the System.ServiceModel.Web but with no success...

Any ideas?

Regards

Dirk

Posts

  • bmoultonbmoulton USMember, Xamarin Team Xamurai

    @DirkSchiffner

    Are you using a precompiled library? If this was built against the Microsoft implementation you may run into problems like this. You should try downloading the source and making an Android library project using their template
    https://github.com/ServiceStack/ServiceStack/tree/master/src

  • DirkSchiffnerDirkSchiffner DEMember

    Actually it is a library I build from source but not against the android runtime. However the required dll is exactly the same I would use within a Android project, same name, version and publik key. And (what I found most confusing) it WORKS without the linker!!! Meanwhile I outsmart the linker by adding the following code to y activity - but I do not know whether this was real smart... :-)

            var workaroundVar = WebMessageFormat.Json;
            workaroundVar.ToString();
    

    With this workaround everything works but that is probably not the way to go?

    In my case I could (eventually) build an android dll from stackservice source but what if I had a real precompiled dll?

    Regards

    Dirk

  • FZelleFZelle DEMember ✭✭✭
    edited July 2013

    but what if I had a real precompiled dll?

    Then you have to ask the company building the binaries to update the binaries.

    I say this again and again, stop trying to use windows DLL's in Android, this is never ment to be working, even if it does atm, it might break with the next version.

    If you want to share code, use PCL

  • DirkSchiffnerDirkSchiffner DEMember

    If two assemblies have the same name, version and public key then I assume they are "THE SAME" at least compatible...

    Am I wrong?

    IF I'm wrong - how can I know by examining a DLL (e.g. with Reflector or ILSpy) which runtime the DLL was build on?

  • FZelleFZelle DEMember ✭✭✭

    If two assemblies have the same name, version and public key then I assume they are "THE SAME" at least compatible...

    No, as all of that is a settings thing, done by the producer of the DLL.

    And it is easy, look into the Doku of the DLL, if it doesn't explicitly states that it is a PCL or compiled for Xamarin.Android, then it in 99% will be for Windows.

Sign In or Register to comment.