Minecraft crashes when I tab out and back in

minecraft-java-editiontechnical-issues

So I have recently got this issue where my Minecraft crashes with exit code 0 whenever I tab out and then tab back into it. Apparently, the issue is due to it being in fullscreen mode, however, I don't really want to have to press F11 every time I want to tab out.

I am running Minecraft version 1.16.5 on Optifine (OptiFine HD U G7 pre1) but I also got this error when running Optifine 1.16.4 and vanilla versions 1.16.4 and 1.16.5. The game crashes with exit code 0, this is the top of the crash log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffcfe00b2c1, pid=5492, tid=25908
#
# JRE version: Java(TM) SE Runtime Environment (8.0_51-b16) (build 1.8.0_51-b16)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.51-b03 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [nvapi64.dll+0x27b2c1]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

I also play on version 1.8.9 with Forge and several mods, however this version works fine.

Best Answer

I think that you should change the version of the Minecraft launcher.

To do that you need to right-click Minecraft and go to properties. Then under Compatibility, you need to tick "Run this program in compatibility mode for:" right under that click and change where it says "Windows 8" to "Windows Vista".

After that the launcher may look different but it fixed the problem for me.