Display a loading while processing a while loop

In one moment of my game, the player is able to import a file to the game.
That’s the function that read each line of the file:

void readTextFile(string file_path)
StreamReader inp_stm = new StreamReader(file_path);

    while (!inp_stm.EndOfStream)
        string inp_ln = inp_stm.ReadLine();
        // Do Something with the input. 


The problem is that when import a huge file, it takes almost 3 minutes to read it, so it looks like it stoped responing, but is acctually processing the file.
So, I would like a loading dialog to show the user that the application did not stop.
But how I do that if the application is tied in the “while”?

StreamReader is working in one run so you cannot cut it in sub section.

You’d be better off trying with WWW class using a local url. Then you can yield and animate something in the meanwhile.