none
.NET Native compiler bug RRS feed

  • General discussion

  •    I'd like to report a bug in the .NET Native compiler. Not 100% sure but looks like it. Here is the code snippet which works perfectly fine if I compile it in Debug without .NET Native and code optimization

                               var objCurrentPlugin = objPopup.Control.PluginContent as ImageDetails;
                               var objPlugin = objCurrentPlugin ?? new ImageDetails();
                               if(objCurrentPlugin == null) {
                                  objPopup.Control.PluginContent = objPlugin;
                               }
    

       If I compile it in Release with .NET Native and code optimization objPopup.Control.PluginContent = objPlugin; never executed. The strange thing is that if I compile it in Debug but with .NET Native and code optimization it still works right. There is something that makes the code to be compiled incorrectly in Release. If I change the above mentioned snippet to this one it works correct for all builds and settings.

                               ImageDetails objPlugin;
                               var objCurrentPlugin = objPopup.Control.PluginContent as ImageDetails;
                               if(objCurrentPlugin == null) {
                                  objPlugin = new ImageDetails();
                                  objPopup.Control.PluginContent = objPlugin;
                               }
                               else {
                                  objPlugin = objCurrentPlugin;
                               }
    


    Alex

    Tuesday, November 8, 2016 1:50 AM