Hi @Nabialek, Sam , Welcome to Microsoft Q&A,
This error message means that your .NET Framework 4.8 desktop project encountered a System.AccessViolationException
exception during the build process. This exception is typically caused by an attempt to read or write protected memory. Make sure all third-party libraries and dependencies are up to date. Check if there are similar memory operations or multi-threaded operations in your code to ensure their safety:
// Example: Check memory access
IntPtr ptr = IntPtr.Zero;
try
{
ptr = Marshal.AllocHGlobal(size);
// Execute operation
}
catch (Exception ex)
{
Console.WriteLine($"Exception: {ex.Message}");
}
finally
{
if (ptr != IntPtr.Zero)
{
Marshal.FreeHGlobal(ptr);
}
}
// Example: Thread synchronization
private static readonly object lockObject = new object();
void SafeMethod()
{
lock (lockObject)
{
// Thread-safe operation
}
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.