Closed GoogleCodeExporter closed 9 years ago
only a question? you're manually changed target framework to 4.0, right?
so actually this isn't a no problem related to a "released" version.
Original comment by diegogu...@gmail.com
on 9 May 2012 at 6:30
NTS Released version 1.12 used in a framework 4.0 project will raise this
exception.
Original comment by prinsjer...@gmail.com
on 9 May 2012 at 6:39
ok now it's clear
Original comment by diegogu...@gmail.com
on 9 May 2012 at 6:47
can you confirm that this code (that uses the trunk version of NTS+GeoAPI)
works also for you?
Original comment by diegogu...@gmail.com
on 9 May 2012 at 10:01
Attachments:
Yes that works for me. When I add the following method, you see that there are
no dynamic assemblies loaded in the console application. The application which
causes the problems however, does have a dynamic assembly.
private static void ReflectInstance()
{
var a = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in a)
{
if (assembly.IsDynamic)
{
Console.WriteLine("dynamic");
}
}
}
Original comment by prinsjer...@gmail.com
on 9 May 2012 at 10:24
Have you referenced proj.net dll? I suspect that the problem come from this dll.
Original comment by diegogu...@gmail.com
on 9 May 2012 at 10:28
I use proj.net yes, but I suspect Castle Windsor is causing it. I cannot change
the ReflectInstance method in GeometryServiceProvider.cs because nhibernate
spatial uses NTS 1.12.
Original comment by prinsjer...@gmail.com
on 9 May 2012 at 10:35
I'm experiencing a similar problem and the cause looks proj.net, but I need to
investigate furthermore
Original comment by diegogu...@gmail.com
on 9 May 2012 at 10:42
I think if you skip all dynamic assemblies in ReflectInstance of
GeometryServiceProvider, the problem will be solved. In my opinion NTS should
work if a dynamic assembly is in memory.
Original comment by prinsjer...@gmail.com
on 9 May 2012 at 11:01
assembly.IsDynamic is from 4.0, so I'm trying to skip if one of these are true:
assembly is System.Reflection.Emit.AssemblyBuilder
assembly.GetType().FullName != "System.Reflection.Emit.InternalAssemblyBuilder"
assembly.GlobalAssemblyCache && assembly.CodeBase ==
Assembly.GetExecutingAssembly().CodeBase
taken from the post you've segnaled
Original comment by diegogu...@gmail.com
on 9 May 2012 at 11:08
This is a patch for GeoAPI hat maybe should fix the problem.
I'm not sure of this because I've not able to reproduce the problem, also in my
code that sometimes all works and sometimes shows the error.
Original comment by diegogu...@gmail.com
on 9 May 2012 at 11:26
Attachments:
How can I use this patch with version 1.12?
Original comment by prinsjer...@gmail.com
on 9 May 2012 at 12:32
you should rebuild NTS from code, and then rebuild NHibernate.Spatial using the
new NTS reference.
Not the easier task to do, sorry.
Actually, I'm not sure the patch fix anything.
Original comment by diegogu...@gmail.com
on 9 May 2012 at 12:41
How do I get the source for NTS 1.12? When I get the source for revision 818 or
820 (is this the correct revision for 1.12?), I get lots of build errors. The
source is not available in the downloads section.
Original comment by prinsjer...@gmail.com
on 15 May 2012 at 1:09
checkout directly the trunk:
http://code.google.com/p/nettopologysuite/source/checkout
if you see lots of build errors, maybe nuget is unable to download the
dependencies
Original comment by diegogu...@gmail.com
on 15 May 2012 at 1:15
Well I have a lot of other projects that depend on NTS 1.12 and the GeoAPI
version that matches it.
Original comment by prinsjer...@gmail.com
on 15 May 2012 at 1:26
so you can take the tag:
http://code.google.com/p/nettopologysuite/source/browse/tags/v1.12
Original comment by diegogu...@gmail.com
on 15 May 2012 at 1:40
The patch works perfectly! I added the patch to version 1.12 and everything
works as it should in .net 4.0, with dynamic assemblies and in MVC4.
Thanks a lot for your support (and for pointing out I needed to learn to work
with branches/tags in SVN ;)
Original comment by prinsjer...@gmail.com
on 16 May 2012 at 7:12
I've experienced in my code the patch I suggest and for me sometimes doesn't
worked.
Actually, I'm unable to have a reproducible error, so it's hard for me to say
that the patch is resolutive. Anyway, happy to see that this works for you :)
Original comment by diegogu...@gmail.com
on 16 May 2012 at 7:19
applied patch to GeoAPI repository with changeset: 67147
see http://geoapi.codeplex.com/SourceControl/changeset/changes/67147
Original comment by diegogu...@gmail.com
on 16 May 2012 at 7:56
Actually I've experienced sometimes that the problem appears again, in a
randomic way :(
Here an explaination that can be helpful: http://goo.gl/jZOiu
"If a type can't be loaded for some reason during a call to Module.GetTypes(),
ReflectionTypeLoadException will be thrown. Assembly.GetTypes() also throws
this because it calls Module.GetTypes()"
Original comment by diegogu...@gmail.com
on 23 Jul 2012 at 3:23
here a patch that I think should be evaluated before the commit.
Original comment by diegogu...@gmail.com
on 23 Jul 2012 at 3:43
Attachments:
The patch does not work for me. Adding
catch (TypeLoadException)
{
return new List<Type>();
}
after catching the reflectiontypeloadexception in GetLoadableTypes fixed my
problem. The problem was an exception which was thrown because an assembly was
not loaded yet.
System.TypeLoadException
Could not load type 'Xft.Core.Model.Ilias.IliasAansluiting' from assembly
'Xft.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
System.TypeLoadException: Could not load type
'Xft.Core.Model.Ilias.IliasAansluiting' from assembly 'Xft.Core,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at GeoAPI.GeometryServiceProvider.GetLoadableTypes(Assembly assembly) in G:\Jeroen\Projects\NTS1.12_JPR_Fixnet4\GeoAPI\GeoAPI\GeometryServiceProvider.cs:line 20
Cheers,
Jeroen.
Original comment by prinsjer...@gmail.com
on 25 Jul 2012 at 10:21
maybe both alternatives can be handful, thanks
Original comment by diegogu...@gmail.com
on 25 Jul 2012 at 10:29
modified patch committed with changeset 68128
Original comment by diegogu...@gmail.com
on 25 Jul 2012 at 10:34
@prinsjeroen:
Where did you get NHibernate.Spatial relying on NTS v1.12?
Original comment by felix.ob...@netcologne.de
on 2 Aug 2012 at 11:38
@felix, I don't know. I spent too much time searching for compatible versions
of NH,NH-spatial, NTS, GeoApi and Sharpmap. I made some modifications to get it
all to work together properly.
Original comment by prinsjer...@gmail.com
on 15 Aug 2012 at 6:21
Can the GeoAPI NuGET be rereleased with this patch?
Original comment by byte...@bytenik.com
on 25 Sep 2012 at 3:02
please see GeoAPI 1.6.1
Original comment by felix.ob...@netcologne.de
on 1 Oct 2012 at 12:50
Original issue reported on code.google.com by
prinsjer...@gmail.com
on 8 May 2012 at 11:40