Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembly Redirects for Spatial4n.Core.NTS 0.3 and NetTopologySuite 1.13 #8

Open
h0st1le opened this issue Jul 1, 2014 · 2 comments

Comments

@h0st1le
Copy link

h0st1le commented Jul 1, 2014

I took your advice and looked into using an assembly redirect to get Spatial4n.Core.NTS 0.3.0.0 working with NetTopologySuite 1.13.2.0. The redirect is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="NetTopologySuite"
          publicKeyToken="f580a05016ebada1"
          culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-1.13.2.0" newVersion="1.13.2.0" />
        </dependentAssembly>
      </assemblyBinding>
    </runtime>
</configuration>

Unfortunately this solution does not work. The latest version of NetTopologySuite no longer is strong named. As such I don't see how I can redirect the versions. I enabled fusion in an attempt to get a detailed log of the failed binding, and noticed the following:

WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN

I thought of redirecting Spatial4n.Core.NTS but again if I compile from source, there is no strong name associated with the assembly, in addition it also retains the same version number. Maybe I'm attempting this is the wrong manner, ideas?

full fusion log:

[7/1/2014 3:42:20 PM] [ERROR] [Go2It.Program.ProcessUnhandled]
Unhandled
The type initializer for 'Spatial4n.Core.Context.Nts.NtsSpatialContext' threw an exception.
Inner: System.IO.FileLoadException: Could not load file or assembly 'NetTopologySuite, Version=1.13.2.0, Culture=neutral, PublicKeyToken=f580a05016ebada1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'NetTopologySuite, Version=1.13.2.0, Culture=neutral, PublicKeyToken=f580a05016ebada1' ---> System.IO.FileLoadException: Could not load file or assembly 'NetTopologySuite, Version=1.12.4448.22555, Culture=neutral, PublicKeyToken=f580a05016ebada1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'NetTopologySuite, Version=1.12.4448.22555, Culture=neutral, PublicKeyToken=f580a05016ebada1'

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  H:\Workspace\dotspatial-go2it\Build\Debug\Go2It.vshost.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = jpenka
LOG: DisplayName = NetTopologySuite, Version=1.12.4448.22555, Culture=neutral, PublicKeyToken=f580a05016ebada1
 (Fully-specified)
LOG: Appbase = file:///H:/Workspace/dotspatial-go2it/Build/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Spatial4n.Core.NTS, Version=0.3.0.0, Culture=neutral, PublicKeyToken=9f9456e1ca16d45e.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: H:\Workspace\dotspatial-go2it\Build\Debug\Go2It.vshost.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.12.4448.22555 redirected to 1.13.2.0.
LOG: Post-policy reference: NetTopologySuite, Version=1.13.2.0, Culture=neutral, PublicKeyToken=f580a05016ebada1
LOG: Attempting download of new URL file:///H:/Workspace/dotspatial-go2it/Build/Debug/NetTopologySuite.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

at Spatial4n.Core.Context.Nts.NtsSpatialContext..ctor(Boolean geo)
at Spatial4n.Core.Context.Nts.NtsSpatialContext..cctor() in z:\Projects\Spatial4n\Spatial4n.Core\Context\Nts\NtsSpatialContext.cs:line 40

Stack trace:    at Go2It.AdminForm.GetDocuments(IndexObject[] iobjects) in H:\Workspace\dotspatial-go2it\src\AdminForm.cs:line 1634
at Go2It.AdminForm.btnCreateIndex_Click(Object sender, EventArgs e) in H:\Workspace\dotspatial-go2it\src\AdminForm.cs:line 1552
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
@synhershko
Copy link
Owner

Try redirecting to the latest strong-named NTS version. I will release a spatial4n version which is not strongly named and is compiled against latest NTS soon.

@synhershko
Copy link
Owner

cc @NightOwl888

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

No branches or pull requests

2 participants