We have a mid-size solution holding projects targeting Net 7, NetStandard 2.1 and Blazor. Some time ago it raised a System.AccessViolationException exception, by that time, we search for changes in our code and were able to workaround it removing references to the Sql Server Diagram stored procedures. Recently it showed up in different development environments. We are able to workaround it by cloning the repository in a new folder. We thought if the issue was in the folder, by removing the folder in cloning it again on a new folder with the same name, it would just work. For our surprise, the error remains. We have tried removing temp folders, .nuget folder, reinstalling packages but still we cannot narrow to something that we can reproduce. The exception is: "System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt." And it happens in different places, but always when making a call or referencing the assembly that "talks" with the database. We are using facil and Microsoft.Data.SqlClient (5.1.1) to communicate with the DB, but what is quite strange, is that just by moving the project to a new folder, it start working. So, here is my question: Is there any other place/folder, where dotnet or Visual Studio (17.5.4) keeps a reference to the solution or projects? Any help will be welcomed, this issues is driving us crazy.
We have tried many things: cleaning, refreshing packages, reinstalling Visual Studio. What we expect is not seeing that exception because it happens based on the folder where the project is located.