![]() |
C# sample attempted to read or write protected memory. - Printable Version +- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum) +-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7) +--- Thread: C# sample attempted to read or write protected memory. (/showthread.php?tid=172) Pages:
1
2
|
RE: C# sample attempted to read or write protected memory. - RexyDallas - 09-01-2018 But the 64-bit version literally won't even run with the DLL that comes with it, and I have no clue how I could ever get the 32-bit version to work in a million years. What could possibly be wrong? RE: C# sample attempted to read or write protected memory. - megamarc - 09-01-2018 I somewhat reproduced the issue:
Code: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Commented out line 76 in Platformer.cs (// engine.SetRasterCallback(callback);): It doesn't crash at all, the frame is partially drawn because it lacks the raster effects but it runs as expected. Restored line 76 and inserted a return in line 130, just at the beggining of the MyRasterEffects() function: It crashes again. So it's definitely something with the delegate manager in C# Copied the generated .exe file from /bin/Debug to the root folder and executed it outside the debugger, double clicking it: It crashes. Changed project properties: Set to C# 5.0 and .NET 4.0: It crashes when running from the debugger, but if I copy the resulting .exe from bin/Debug to the root folder and execute it directly, it DOES NOT crash. So it seems to be a combination of the environment, the .NET target and the debugger... RE: C# sample attempted to read or write protected memory. - greysonstorm - 09-01-2018 Been messing around with this some more because this annoying me now, I got 64bit to work without changing any code just creating new project and select c#5.0 and 4.5.1 and it works in debug but not release but 32bit wasnt working at all, my wife looked changed the file allignment to 2048 and put the tilengine.cs in it owns class library and now everything works ....... not sure if was just a fluke but it all works now in sharpdevelop, now i was install vs2017 this morning at the same time but shes a c# developer so i defer to her wisdom RE: C# sample attempted to read or write protected memory. - megamarc - 09-02-2018 Thank for your experience man! Nowadays, any end-user application sits at the top of a huge mountain of third-party software: libraries, frameworks, runtimes, OS services... In my daily work as a professional developer I've seen similar issues. You cannot expect to know why something strange suddenly happens, but just to find another combination in which the issue disappears. Your wife seems like a C# guru, kudos for her ![]() |