❔ What does this exception mean?
(Sorry for reposting as I already put it in the help chat and don't want it to get buried)
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
Basically I am passing a File Path as a string to another classfile and this classfile uses a dll and reads the File provided to a array. as soon as it gets to the code that do a value change onto the file, this exception is thrown.
The File in question is not accessed or being used by any other method and the path is correctly seen in the class file too.
6 Replies
I would guess the string isn't null terminated
your dll reads beyond the string memory because it doesn't rely on the length
strings in c# are wide, there might be a weird problem with that
probably an issue with the dll/libraryimport, yeah
you can (should) either specify the string marshalling, or straight up pass the correct type (
sbyte*
or ushort*
)how do I do this ?
i don't exactly know what your native signature looks like. can't help that much
nvm. I am not gonna use this library in the end.
gonna fallback to the old one
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.