title: Angular 4.x + Cordova : FileReader fails silently (white screen of death)
body: <p>I have an Angular 4.3 + Cordova application that used to work very well. But now, I get a blank screen on app start-up, and nothing happens any more.</p>
  
  <p>After digging a while I realized where it comes from :</p>
  
  <p>my home page is protected by a <code>CanActivate</code> guard that will check some file-system-persisted preferences and redirect the user to another page if this is the first run or if a required preference is missing, to fill-in the required properties.</p>
  
  <p>So the launch of the app depends on my <code>CanActivate</code> guard that depends on a <code>PreferenceService</code> that itself depends on a <code>FileSystemService</code> that I implemented myself. The problem is that when I try to read the file where user's preferences are stored, not a single callback is fired, nothing happen, <strong>not even an error</strong>.</p>
  
  <p>this is the part of my <code>FileSystemService</code> that fails without any error :</p>
  
  <pre class="lang-js prettyprint-override"><code>read(file: FileEntry, mode: "text" | "arrayBuffer" | "binaryString" | "dataURL" = "text"): Observable&lt;ProgressEvent&gt; {
      return this.cdv.ready.flatMap(() =&gt; {
          return Observable.create(observer =&gt; {
              file.file(file =&gt; {
                  let reader = new FileReader();
                  reader.onerror = (evt: ErrorEvent) =&gt; {
                      this.zone.run(() =&gt; observer.error(evt)); //never triggered
                  };
                  reader.onload = (evt: ProgressEvent) =&gt; {
                      this.zone.run(() =&gt; observer.next(evt)); //never trigerred
                  };
                  switch (mode) {
                      case "text":
                          reader.readAsText(file);
                          break;
                      case "arrayBuffer":
                          reader.readAsArrayBuffer(file);
                          break;
                      case "binaryString":
                          reader.readAsBinaryString(file);
                          break;
                      case "dataURL":
                          reader.readAsDataURL(file);
                          break;
                  }
              });
          });
      });
  }
  </code></pre>
  
  <p>Why does this even happen and how can I deal with that so my callbacks get triggered ?</p>