Jennilein1991 / assimp-net

Automatically exported from code.google.com/p/assimp-net
0 stars 0 forks source link

Runtime errors when compiled with .NET 3.5 #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Change target framework to .NET 3.5
2. Change reference to IntPtr.Add to Marshal.ReadIntPtr
3. Compile AssimpNet
3. Create a .NET 3.5 testbed application
4. Load any 3D model.

What is the expected output? What do you see instead?
The expected output is the model is loaded successfully.  Instead, I get a 
System.NullReferenceException which occurs in Material.cs line 411.  The 
properties variable is null when it tries to access the Length property.

What version of the product are you using? On what operating system?
2.1.2 Refresh

Please provide any additional information below.
Like I stated in the steps to reproduce, I had to change any reference to 
IntPtr.Add to Marshal.ReadIntPtr.  Obviously when I compile under .NET 4.0 for 
AssimpNet and the testbed application, everything works fine.  It's only when I 
try and compile under .NET 3.5.

Original issue reported on code.google.com by soco...@gmail.com on 30 Oct 2012 at 10:00

GoogleCodeExporter commented 9 years ago
ReadIntPtr would not be a replacement for Add in these cases. Add is really 
simple on pre-4.0, just ptr.ToInt64() + offset, which I've added as a helper 
method in MemoryHelper. I also changed MarshalArray in memory helper to return 
a zero-length array upon failure, although you were probably encountering that 
null reference exception on account of Marshal.ReadIntPtr.

I locally built the solution targeting 3.5 and everything seems to be working 
as they should.

Original comment by nicholas.woodfield on 1 Nov 2012 at 11:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by nicholas.woodfield on 1 Nov 2012 at 11:30