Windows 7 64bit - Arithmetic operation resulted in an overflow

Mar 4, 2010 at 12:22 PM

Hi,

i get an error:

rapi.CopyFileToDevice(input + @"\export\art.txt", @"\art.txt", true);

I have downloaded the lates version of NETCF.

 

Developer
Mar 4, 2010 at 12:31 PM

http://rapi.codeplex.com/WorkItem/View.aspx?WorkItemId=4469

Seems that you are not using the last source code from the repository.

Mar 11, 2010 at 6:51 AM

Hi,

i have downloaded the latest source code but the problem is still there...

What can i do ?

 

Mar 11, 2010 at 2:23 PM

Ok problem solved, Robert was right: download and compile the latest Source code and USE IT IN YOUR PROJECT! :)

Jun 15, 2010 at 1:53 AM

I have had this problem too on moving to 64-bit Windows 7, and the latest source code did not solve the problem.

 

However, I tracked it down to the use of IntPtr (handle). Some of the handles returned were outside the range of a signed 32-bit int.

 

Replacing

private const short INVALID_HANDLE_VALUE = -1;   

by      

private IntPtr INVALID_HANDLE_VALUE = (IntPtr)(-1);

 

and removing any (int) casts in comparisons with INVALID_HANDLE_VALUE solved the problem for me.

Jul 29, 2010 at 12:53 PM

Very Good my friend!

 

It's works fine!

Jan 3, 2011 at 4:55 PM

Does anyone related to the project know when this fix will be implemented on the official source?

Thanks oneillpetert for the code change information.

 

 

 

Developer
Jan 3, 2011 at 5:54 PM

It's already fixed and implemented since over a year.

http://rapi.codeplex.com/SourceControl/changeset/changes/27098

Feb 23, 2012 at 7:34 PM

Actually, I just downloaded the latest code and this has not been fixed. I had to do what oneillpetert recommended to get to work.

Developer
Feb 23, 2012 at 7:52 PM

Just look at the changeset: http://rapi.codeplex.com/SourceControl/changeset/changes/27098 and you'll see it was fixed on Wed Sep 23 2009 at 10:56 PM.

May 17, 2012 at 9:46 PM

Downloaded today (2012-05-17) and get the same error. Download my patch (or whoops just noticed urmstores already submitted a patch for the same issue so you can also try his/hers) to get around the issue. Error occurs when running on 64 bit systems.

Developer
Jul 12, 2012 at 9:34 PM

You don't need to apply a patch. Just download the latest source code from the repository. There have been other improvements and bugfixes too.

Jul 24, 2012 at 10:29 AM

I have tried all the fixes that has been outlined within this forum and I am still receiving the error:

System.OverflowException: Arithmetic operation resulted in an overflow. as System.IntPtr.op(Explicit(IntPtr value) at OpenNETCF.Desktop.Communication.RAPI.SetDeviceFileTime(String FileName, RAPIFileTime DesoredTime, DateTime NewTime) at OpenNETCF.Desktop.Communication.RAPI.CopyFileTODevice(String LocalFileNmae, String REmotrFileName, Boolean Overwrite)

Does anyone know what I should do?

Sep 10, 2014 at 10:40 AM
I also have the same problem with "Arithmetic operation resulted in an overflow", when running an application on win7 64bit version

problems with these:
OpenNETCF.Desktop.Communication.RAPI.SetDeviceFileTime
OpenNETCF.Desktop.Communication.RAPI.CopyFileToDevice

Do anyone have a solution?
Sep 10, 2014 at 12:54 PM
I got it working, seems that I had compiled the dll with "Any CPU" in visual studio 2008.
After compiling the code again with "64 bit cpu" it workes just fine.