AccessViolationException when reading Properties.Settings.Default field. .NET 4.0, C#, VS10


i having issue reading specific property properties.settings.default. first time run code during debug session, successful. second time run, accessviolationexception. exception happens when versionmajor property of properties.settings.default, not versionminor property.

 

            byte[] tmparray;             byte[] message = new byte[599];             int = 0;              message[i++] = 16; //write multiple registers             message[i++] = 0; //high byte of address             message[i++] = 98; //low byte of address             message[i++] = 1; //high byte of register count             message[i++] = 40; //low byte of register count             message[i++] = 0; //reserved             message[i++] = properties.settings.default.versionmajor; //major version number             message[i++] = properties.settings.default.versionminor; //minor version number 

 

both properties of byte type. insight cause of issue beneficial.

thanks


i solved problem. later in application, calling down custom api in .dll file has unmanaged code.this api has buffer overflow bug.  then, code run again, , data corrupted.  as test, temporarily increased array 599 606 bytes, , code executes perfectly. have update api account this.


.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Post a Comment

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'