Bug 14065 - vAttempting to JIT compile method '(wrapper unknown) System.Net.NetworkInformation.MacOsStructs.ifaddrs:PtrToStructure (intptr,object)'
Summary: vAttempting to JIT compile method '(wrapper unknown) System.Net.NetworkInform...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: 7.0.6
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-08-19 05:04 UTC by Mike James
Modified: 2015-05-09 04:38 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Mike James 2013-08-19 05:04:24 UTC
A customer has reported the following error:

vAttempting to JIT compile method '(wrapper unknown) System.Net.NetworkInformation.MacOsStructs.ifaddrs:PtrToStructure (intptr,object)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

Using the following code: 


private void UpdateLiveAvailability(string productCode, string stockArea)
{
ACRDocXWebService.ProductAvailability pa;

try
{
pa = WebServices.GetProductAvailability(productCode, stockArea);

if (pa != null)
{
//Redisplay the data
this.InvokeOnMainThread(() => {

RootElement reInventorySectionRoot = new RootElement("Stock Availability") {
new Section("") {
new StyledStringElement("Stock On Hand", pa.PrdAreaSoh.ToString("n2"), UITableViewCellStyle.Value1),
new StyledStringElement("Committed", (pa.PrdAreaCom + pa.PrdAreaUnp).ToString("n2"), UITableViewCellStyle.Value1),
new StyledStringElement("Back Order", pa.PrdAreaBak.ToString("n2"), UITableViewCellStyle.Value1),
new StyledStringElement("On Order", pa.PrdAreaOrd.ToString("n2"), UITableViewCellStyle.Value1),
new StyledStringElement("Free", (pa.PrdAreaSoh - pa.PrdAreaCom - pa.PrdAreaUnp).ToString("n2"), UITableViewCellStyle.Value1),

}
};

var shp = new Section("Shipments");
if (pa.PrdNextQty > 0)
{
shp.Add(new StyledStringElement(pa.PrdNextEta, pa.PrdNextQty.ToString("n2"), UITableViewCellStyle.Value1));
}
if (pa.PrdFollQty > 0)
{
shp.Add(new StyledStringElement(pa.PrdFollEta, pa.PrdFollQty.ToString("n2"), UITableViewCellStyle.Value1));
}
if ((pa.PrdNextQty == 0) && (pa.PrdFollQty == 0))
{
shp.Add(new StringElement("No new shipments available"));
}

lock (oLockDialog)
{
reInventorySectionRoot.Add(shp);

inventorySection.Clear();
inventorySection.Footer = "";
inventorySection.Add(reInventorySectionRoot);

this.ReloadData();
}

});
} else
{
//Redisplay the data
this.InvokeOnMainThread(() => {

lock (oLockDialog)
{
//Unable to get live pricing
inventorySection.Clear();
inventorySection.Footer = "Live stock quantities currently unavailable.";
this.ReloadData();
}
});

}

} catch (SoapException soapex)
{
VantageErrorLog.Throw(Title: "Error retrieving Stock Availability",
Method: "UpdateLiveAvailability",
Location: "PIPO107",
Code: "PIPO107",
Message: soapex.Message,
ex: null,
TellUser: false,
WriteToDatabase: true,
TellVantageSupport: true,
Rethrow: false);
//Redisplay the data
this.InvokeOnMainThread(() => {

lock (oLockDialog)
{
//Unable to get live pricing
inventorySection.Clear();
inventorySection.Footer = "Live stock quantities currently unavailable.";
this.ReloadData();
}
});
} catch (Exception ex)
{
//THIS IS THE EXCEPTION THAT WAS TRAPPED
VantageErrorLog.Throw(Title: "Error retrieving Stock Availability",
Method: "UpdateLiveAvailability",
Location: "PIPO108",
Code: "PIPO108",
Message: ex.Message,
ex: null,
TellUser: false,
WriteToDatabase: true,
TellVantageSupport: true,
Rethrow: false);
//Redisplay the data
this.InvokeOnMainThread(() => {

lock (oLockDialog)
{
//Unable to get live pricing
inventorySection.Clear();
inventorySection.Footer = "Live stock quantities currently unavailable.";
this.ReloadData();
}
});
}
}
Comment 1 Sebastien Pouliot 2013-08-20 13:47:48 UTC
There's nothing about System.Net.* in the code above and it can't be compiled (incomplete).
Please attach a self-contained test case that can reproduce the issue.
Comment 2 Zoltan Varga 2013-08-20 15:48:55 UTC
This is from desk #40840, it looks similar to the other 'Attempting to JIT compile' bug, i.e. it only happens randomly.
Comment 3 PJ 2013-11-19 17:05:52 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 4 Joseph Hanna 2013-11-19 17:11:10 UTC
I have seen this happen again.  I am happy for you to close this. I will open another case if it reoccurs.
Comment 5 Joseph Hanna 2013-11-19 17:11:37 UTC
*haven't*
Comment 6 Sebastien Pouliot 2013-11-19 17:36:39 UTC
Thanks for confirming!
Comment 7 PJ 2013-12-11 18:45:52 UTC
This fix is planned to be released with Xamarin.iOS 7.0.6, which should hit the beta channel before December 23rd.
Comment 8 Mohit Kheterpal 2013-12-17 08:57:39 UTC
As per comment 4 and comment 5, this issue haven't seen again.

Hence closing this issue.
Comment 9 Joseph Hanna 2015-05-05 11:33:04 UTC
Hi guys, it's back!  With thanks to Insights, I can tell which method is causing it.

THE EXCEPTION:-
ExecutionEngineExceptionAttempting to JIT compile method '(wrapper unknown) System.Net.NetworkInformation.MacOsStructs.ifaddrs:PtrToStructure (intptr,object)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

STACK TRACE:-
at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
  at System.Net.NetworkInformation.MacOsNetworkInterface.ImplGetAllNetworkInterfaces () [0x00000] in <filename unknown>:0 
  at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces () [0x00000] in <filename unknown>:0 
  at VantageIT.Net.VantageNetwork.GetIPAddress () [0x00000] in <filename unknown>:0 
  at VantageIT.ACR.SalesTALK.VantageDiagnostics.GetDiagnosticReport (Boolean includeHTMLandBodyTags) [0x00000] in <filename unknown>:0 
  at VantageIT.Errors.VantageErrorLog+<LogErrorWithVantageSupportDesk>c__AnonStorey0.<>m__0 () [0x00000] in <filename unknown>:0 
  at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0 

THE METHOD:-

    public static string GetIPAddress()
    {
      string IPAddress = "";

      try
      {

        var nix = (from nic in NetworkInterface.GetAllNetworkInterfaces()
                       where nic.Id.StartsWith("en") //wireless or lan for emulator
                         || nic.Id.StartsWith("pdp_ip")
                       select nic
                  );

        foreach (var nic in nix)
        {
          var ipProps = nic.GetIPProperties();

          // We're only interested in IPv4 addresses
          var ipv4Addrs = ipProps.UnicastAddresses
                .Where(addr => addr.Address.AddressFamily == AddressFamily.InterNetwork);


          foreach (var addr in ipv4Addrs)
          {
            Debug.WriteLine(string.Format("NIX Addr: {0}    ", addr.Address));
            IPAddress = addr.Address.ToString();
            break;
          }
        }

      } catch (Exception ex)
      {
        var d = new Dictionary<string, string>() {
          { "Message", "Error obtaining IP Address" },
          { "IPAddress", IPAddress }
        };
        Insights.Report(ex, d, ReportSeverity.Warning);
      }
      return IPAddress;
    }
Comment 10 Zoltan Varga 2015-05-05 16:19:38 UTC
Is this method called from multiple threads at the same time ?
Comment 11 Joseph Hanna 2015-05-09 04:12:39 UTC
No - it is only being called once when the app fires up
Comment 12 Zoltan Varga 2015-05-09 04:33:56 UTC
Does insights have any other information like what kind of devices have this problem, what ios version etc. ?
Comment 13 Zoltan Varga 2015-05-09 04:38:00 UTC
Also, what xamarin.ios version is this ?