[gdal-dev] GDAL.NET System.TypeInitializationException
Scott Senften
scott at senften.com
Sat Oct 27 12:42:12 PDT 2018
I'm sorry. I probably confused matters. I created a new .NET solution and
project in visual studio and copied and added
https://github.com/OSGeo/gdal/blob/master/gdal/swig/csharp/apps/OGRGEOS.cs to
the new project. Then I installed the GDAL.NET nuget package as the
reference to this new project. Everything builds but I get the run time
error sent prior.
What I meant was within the OGRGEOS.cs file I don't see a call to
GdalConfiguration.cs, and I didn't do anything beyond building the project
and attempting to run it. If there is another packaged required or if there
is another configuration step required, I missed it.
Thanks
Scott
On Sat, Oct 27, 2018 at 1:35 PM Tamas Szekeres <szekerest at gmail.com> wrote:
> Not sure how you project is looking like, I thought you added the GDAL.NET
> nuget package as the reference.
> Within this package, you can find some code GdalConfiguration.cs, where
> the static constructor contains the necessary code to set up the
> environment programmatically.
> Alternatively you can set the corresponding environment variables manually
> on your system so as to get the things working.
>
> Best regards,
>
> Tamas
>
>
>
> Scott Senften <scott at senften.com> ezt írta (időpont: 2018. okt. 27., Szo,
> 20:14):
>
>>
>> Thank you for quick response.
>>
>> No, I don't see the configuration calls being used. I'm working from the
>> examples in the gdal/swig/csharp/apps directory, specifically
>> https://github.com/OSGeo/gdal/blob/master/gdal/swig/csharp/apps/OGRGEOS.cs
>>
>> I haven't written any code for myself yet. I'm just trying to confirm I
>> have a proper dev environment setup using the given demos. Is there a
>> better starting point for c#/dotnet development? Is there a quick start or
>> a tutorial that I missed?
>>
>> Thanks again.
>>
>> Scott
>>
>> On Sat, Oct 27, 2018 at 9:12 AM Tamas Szekeres <szekerest at gmail.com>
>> wrote:
>>
>>> Scott,
>>>
>>> Have you called GdalConfiguration.ConfigureGdal() and/or
>>> GdalConfiguration.ConfigureOgr() at the beginning of your code?
>>>
>>> Best regards,
>>>
>>> Tamas
>>>
>>>
>>>
>>>
>>> Scott Senften <scott at senften.com> ezt írta (időpont: 2018. okt. 26., P,
>>> 23:59):
>>>
>>>>
>>>> My apologies; I'm guessing this is well trod ground, but I couldn't
>>>> find a good search for the archives and, on inspection, I couldn't find an
>>>> appropriate topic.
>>>>
>>>> I'm trying to build one of the GDAL swig c# examples, specifically I
>>>> have tried both OGRGEOS and ORSTransform. I've installed GDAL.NET
>>>> 2.3.1 from nuget (https://www.nuget.org/packages/GDAL.NET/). My
>>>> projects build but both throw System.TypeInitializationException at
>>>> runtime.
>>>>
>>>> For OGRGEOS, the error is
>>>>
>>>>> Exception thrown: 'System.TypeInitializationException' in
>>>>> ogr_csharp.dll
>>>>> An unhandled exception of type 'System.TypeInitializationException'
>>>>> occurred in ogr_csharp.dll
>>>>> The type initializer for 'OSGeo.OGR.OgrPINVOKE' threw an exception.
>>>>>
>>>>> The program '[34872] dotnet.exe' has exited with code -1073741510
>>>>> (0xc000013a).
>>>>>
>>>>
>>>> I'm guessing that I either have a configuration issue or a dependency
>>>> issue with the underlying native code, but, at this point, I'm just
>>>> guessing.
>>>>
>>>> Any help would be appreciated,
>>>>
>>>> Scott
>>>>
>>>> _______________________________________________
>>>> gdal-dev mailing list
>>>> gdal-dev at lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181027/703424c6/attachment.html>
More information about the gdal-dev
mailing list