title: Phonegap and Windows Phone 7: IndexOutOfBoundsException
body: <p>I am having issues moving a phonegap application from Android and iOS to WP8. It seems to be crashing when I try to load some language .JSON files. The versions that I use are phonegap 2.9.0 and jQuery 2.0.3. Everything is working as intended on Android and iOS.</p>
  
  <p>Console output:</p>
  
  <pre><code>'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.Serialization.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  Updating IsolatedStorage for APP:DeviceID :: ********-****-****-****-***********
  CordovaBrowser_Navigated :: www/index.html
  CommandString : Device/getDeviceInfo/Device899915039/[]
  'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded         'C:\windows\system32\System.ServiceModel.Web.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols.
  CommandString : NetworkStatus/getConnectionInfo/NetworkStatus899915040/[]
  An exception of type 'System.NotSupportedException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary
  The thread 0x1160 has exited with code 259 (0x103).
  The thread 0x80c has exited with code 259 (0x103).
  CommandString : DebugConsole/log/DebugConsole899915041/"Received Event: deviceready"
  Log:["Received Event: deviceready","DebugConsole899915041"]
  The thread 0x8c8 has exited with code 259 (0x103).
  CommandString : File/readResourceAsText/File899915042/["localization/nb-NO.json"]
  A first chance exception of type 'System.IndexOutOfRangeException' occurred in no.visma.patentstyret.DLL
  An exception of type 'System.IndexOutOfRangeException' occurred in no.visma.patentstyret.DLL but was not handled in user code
  </code></pre>
  
  <p>This is the ajax loading of the language files:</p>
  
  <pre><code> var _loadDataSet = function(callback) {
          $.ajax({url: "localization/" + _language + ".json", async: false, dataType: 'json', success: function(data) {
              _dataSet = data;
              if(callback) {
                  callback();
              }
          }}).error(function(e) {
              console.error("Error in language files.");
              console.error(e);
          });
      };
  </code></pre>
  
  <p>I have no idea where to start, any help would be much appreciated!</p>