[Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Slide
I am trying to compile and use the ZeroC Ice remoting library for armhf to run on my RaPi 2. The compilation goes fine, but when running the test suite I am getting a NullReferenceException on the pointer assignment in the following code: fixed(byte* p = _bytes[_position]) { *((float*)p) =

Re: [Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Zoltan Varga
Hi, Mono sets up signal handlers in order to implement throwing null reference exceptions. This means that some SIGSEGVs etc. get converted to NullReferenceExceptions. Zoltan On Thu, Mar 26, 2015 at 5:37 PM, Slide slide.o@gmail.com wrote: Yes, I can tell that the pointer is

Re: [Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Zoltan Varga
Hi, arm might require aligned reads, i.e. 'p' should be 4 byte aligned in this case. Zoltan On Thu, Mar 26, 2015 at 3:28 PM, Slide slide.o@gmail.com wrote: I am trying to compile and use the ZeroC Ice remoting library for armhf to run on my RaPi 2. The compilation goes fine,

Re: [Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Slide
That's a good point! Can you tell me where in the mono code that the unaligned accesses are handled? I'd just like to confirm. Thanks! slide On Thu, Mar 26, 2015 at 1:13 PM Zoltan Varga var...@gmail.com wrote: Hi, arm might require aligned reads, i.e. 'p' should be 4 byte aligned in this

Re: [Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Slide
Yes, I can tell that the pointer is unaligned, I was wondering why I would get a NullReferenceException for an unaligned access. I would assume that mono sets up some handler or something that catches unaligned exceptions? Maybe not? On Thu, Mar 26, 2015 at 2:23 PM Brandon Perry

Re: [Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Zoltan Varga
Hi, You can check whenever the pointer is aligned by converting it into an int. Zoltan On Thu, Mar 26, 2015 at 4:53 PM, Slide slide.o@gmail.com wrote: That's a good point! Can you tell me where in the mono code that the unaligned accesses are handled? I'd just like to

Re: [Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Brandon Perry
Could also cast to an IntPtr and check the Size property, which would return the number of bytes in the pointer? https://msdn.microsoft.com/en-us/library/system.intptr.size%28v=vs.110%29.aspx Might be misunderstanding the issue though. On Thu, Mar 26, 2015 at 4:20 PM, Zoltan Varga

Re: [Mono-dev] NRE when using pointers on armhf

2015-03-26 Thread Slide
Thanks for the confirmation. I appreciate the help! On Thu, Mar 26, 2015 at 3:11 PM Zoltan Varga var...@gmail.com wrote: Hi, Mono sets up signal handlers in order to implement throwing null reference exceptions. This means that some SIGSEGVs etc. get converted to NullReferenceExceptions.