Weird Access violation (no exception) when using StreamReader
I have no idea why reading from this stream and then referencing from the vertices list is causing a memory violation, I need help
12 Replies
Saying access violation then saying no exception doesn't make sense to me. Can you run in the debugger and paste the exact symptoms
it literally does not do anything because it doesn't throw an access violdation exception
the app just crashes in the debugger
it says The program '[33224] StorybrewEditor.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'
no call stack or anything
If you install windebug you'll most likely be able to get a reasonable stack, but that is odd
it's weird that this code, which seems completely safe, is causing something like this
Also if you bisect your code, or otherwise figure out which line is causing the issue that might help. Perhaps the issue is from another thread, tho
actually I don't think it's the StreamReader
it's the vertices list
it's either indexing or adding to it causes an error but idk why
Even if you access a list with an invalid index that does not cause a native memory fault
Something else is going on
yeah that's the part that stumped
so removing the code that indexed that list fixed it
so it's the indexing
I literally do not see how it could cause an error, it should definitely be within bounds
My brain goes... is this
Object3d
used by some comparatively unsafe code... and your particular Vector3
that gets added... results in an object state that causese that unsafe code to exceptthe parent program is written in completely safe code, Object3d is using a 3D library which relies on System.Numerics
and also the issue comes from indexing faceVertices list (I narrowed it down) but I still have no idea why
To confirm, the error still occurs when you do all of the indexed-access, but don't actually use them with .Add?
if so... that's weird to me
really really weird\
sadly I haven't really fixed the issue, it seems like trying to do an alternative would be way too complicated
I don't see how something this simple could cause a memory violation when there's no unsafe code