Unity 2017.1f1 Freezes while compiling scripts

My Unity started to freeze every time i compile scripts few days ago. The loading “circle” on bottom right corner just freezes and so does Unity, so i have to stop the process from task manager. Restarting Unity obviously didn’t work and i also tried to restart my pc. I’m using Photon on my project and i have heard that some people had same issue with photon but their solutions didnt work for me.

I am having something similar happening. I …think… it is because I have a script which has many,many errors in it. I am working on writing a method which has hundreds of lines in it with the predominant error being an invalid,incorrect calls(hundreds of such error calls) to a method in the same class. If I go back and comment out the entire contents of the script then the freeze on “compiling scripts” goes away. I speculate the reason it is freezing is either 1)totally cannot cope with that many errors or 2)there’s a combinatorial explosion in the amount of processing required to compile.it might never finish compiling,i ran out of patience. the editor also will not shut down normally.

My solution:

Close all programs when compilating, and disable firewall, the last is very important!

Quick fix if you get stuck is just to reimport the script(s) you’ve changed.