Mid-2015 MacBook Pro shuts off without warning when an Ethernet adapter is *not* plugged into a Thunderbolt port. Why? I have been dealing with random crashes all of the time on my MacBook Pro. The screen will go black (not off) for about 30 seconds while the fans spin up to max, then everything shuts off. When I boot back up there is no warning that my computer was shut off because of a problem like there is with a kernel panic. The crash occurs for all users of the computer, so it must be something that got installed for all users and not in my Home directory.

I tried many different things to resolve this (i.e. standard resetting NVRAM, reinstall the OS, safe mode, etc). The only thing that has "fixed" the problem was booting into Safe Mode, though I cannot easily tell what changed since there is not much to test there. The hardware diagnostics do not indicate any problems.

From what I can tell, nothing gets logged into the console when the computer shuts off. There is nothing that indicates power failure or overheating either, which is strange. 

For troubleshooting, I tried a few things one at a time:


Erasing and rebuilding the Spotlight index (mdutil -Ea → mdutil -ia off → mdutil -ia on)
Uninstalling enterprise VPN software
Resetting network settings 


None of these things seemed to work. However, I remembered that I do not have this issue when plugged into my Thunderbolt Displays, which led me to believe there could possibly be something related to the Thunderbolt port that causes this (quite the longshot, admittedly). I tried all of my Thunderbolt dongles one at a time:


HDMI
DisplayPort
Ethernet


And I stopped here. When the Ethernet adapter is plugged in (not necessarily attached to an actual Ethernet cable) the crashes simply do not happen. As soon as I unplug it, I get about 5 minutes and the laptop shuts off. Why on earth could this possibly be happening? The only difference when plugging in the adapter on ifconfig is:

en5: flags=8863&lt;UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
    options=10b&lt;RXCSUM,TXCSUM,VLAN_HWTAGGING,AV&gt;
    ether a8:20:66:1b:92:2b 
    nd6 options=201&lt;PERFORMNUD,DAD&gt;
    media: autoselect (none)
    status: inactive
There is a nice thread about it here: https://de.ifixit.com/Antworten/Ansehen/320496/Randomly+shuts+down+when+not+connected+to+an+external+display.

Turns out there maybe a few reasons why this happens:


Thermal paste
Thunderbolt-Ethernet-Driver
Magnetic sensor that indicates when lid is closed is damaged.


This is definitely a thread you want to read, several very useful info there.

I've been having this problem my self, right now testing your fix, having just an ethernet dongle connected.

Good luck