Why am I getting access violation errors when nesting aura:if?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












4














When multiple aura:if are nested together, I'm getting an error like the following:




Access Check Failed! AttributeSet.get(): attribute 'value2' of component 'markup://c:demo1 1:0'
is not visible to 'markup://aura:if 6:0'.




Example Reproduction



<aura:application >
<aura:attribute name="value1" type="String" access="private" />
<aura:attribute name="value2" type="String" access="private" />
<lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
<aura:if isTrue="!v.value1 eq 'a'">
<lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
<aura:if isTrue="!v.value2 eq 'b'">
<lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
</aura:if>
</aura:if>
</aura:application>


This occurs when the attribute is private, and there's at least two levels of aura:if statements. It also only occurs after causing the innermost lightning:input to render, then subsequently unrendering it by changing Value 1 a few times. Once this happens, all further renderings will cause this error.



Why is this happening, and what can I do to avoid it?










share|improve this question




























    4














    When multiple aura:if are nested together, I'm getting an error like the following:




    Access Check Failed! AttributeSet.get(): attribute 'value2' of component 'markup://c:demo1 1:0'
    is not visible to 'markup://aura:if 6:0'.




    Example Reproduction



    <aura:application >
    <aura:attribute name="value1" type="String" access="private" />
    <aura:attribute name="value2" type="String" access="private" />
    <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
    <aura:if isTrue="!v.value1 eq 'a'">
    <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
    <aura:if isTrue="!v.value2 eq 'b'">
    <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
    </aura:if>
    </aura:if>
    </aura:application>


    This occurs when the attribute is private, and there's at least two levels of aura:if statements. It also only occurs after causing the innermost lightning:input to render, then subsequently unrendering it by changing Value 1 a few times. Once this happens, all further renderings will cause this error.



    Why is this happening, and what can I do to avoid it?










    share|improve this question


























      4












      4








      4







      When multiple aura:if are nested together, I'm getting an error like the following:




      Access Check Failed! AttributeSet.get(): attribute 'value2' of component 'markup://c:demo1 1:0'
      is not visible to 'markup://aura:if 6:0'.




      Example Reproduction



      <aura:application >
      <aura:attribute name="value1" type="String" access="private" />
      <aura:attribute name="value2" type="String" access="private" />
      <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
      <aura:if isTrue="!v.value1 eq 'a'">
      <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
      <aura:if isTrue="!v.value2 eq 'b'">
      <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
      </aura:if>
      </aura:if>
      </aura:application>


      This occurs when the attribute is private, and there's at least two levels of aura:if statements. It also only occurs after causing the innermost lightning:input to render, then subsequently unrendering it by changing Value 1 a few times. Once this happens, all further renderings will cause this error.



      Why is this happening, and what can I do to avoid it?










      share|improve this question















      When multiple aura:if are nested together, I'm getting an error like the following:




      Access Check Failed! AttributeSet.get(): attribute 'value2' of component 'markup://c:demo1 1:0'
      is not visible to 'markup://aura:if 6:0'.




      Example Reproduction



      <aura:application >
      <aura:attribute name="value1" type="String" access="private" />
      <aura:attribute name="value2" type="String" access="private" />
      <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
      <aura:if isTrue="!v.value1 eq 'a'">
      <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
      <aura:if isTrue="!v.value2 eq 'b'">
      <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
      </aura:if>
      </aura:if>
      </aura:application>


      This occurs when the attribute is private, and there's at least two levels of aura:if statements. It also only occurs after causing the innermost lightning:input to render, then subsequently unrendering it by changing Value 1 a few times. Once this happens, all further renderings will cause this error.



      Why is this happening, and what can I do to avoid it?







      lightning-aura-components






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 28 '18 at 14:30









      Mohith Shrivastava

      59.9k796138




      59.9k796138










      asked Dec 23 '18 at 8:24









      sfdcfox

      248k11189424




      248k11189424




















          1 Answer
          1






          active

          oldest

          votes


















          4














          This is a bug with access checking in the Lightning Web Component framework, and may manifest as an error in Aura components when this happens. There are a few different ways to reproduce it; the one in the answer is just one form. The known solutions are as follows:



          Make The Attribute Public



          The access exception will only occur on private attributes.



          Avoid aura:if



          The way aura:if rerenders causes the bug to surface in LWC. Instead, hide the elements using normal CSS (or SLDS). Here's an example fix:



          <aura:application extends="force:slds">
          <aura:attribute name="value1" type="String" access="private" />
          <aura:attribute name="value2" type="String" access="private" />
          <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
          <div class="!v.value1 eq 'a'?'':'slds-hide'">
          <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
          <div class="!v.value2 eq 'b'?'':'slds-hide'">
          <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
          </div>
          </div>
          </aura:application>


          Avoid Usage of LWC Components



          Using any component that is a LWC component (basically anything in the lightning namespace) can result in this error. You can replace it with the basic ui namespace component (e.g. ui:inputText instead of lightning:inputText). This will probably not be practical in most applications, but it is a possible workaround.



          This has been filed as W-5722782.






          share|improve this answer




















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "459"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f244533%2fwhy-am-i-getting-access-violation-errors-when-nesting-auraif%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            This is a bug with access checking in the Lightning Web Component framework, and may manifest as an error in Aura components when this happens. There are a few different ways to reproduce it; the one in the answer is just one form. The known solutions are as follows:



            Make The Attribute Public



            The access exception will only occur on private attributes.



            Avoid aura:if



            The way aura:if rerenders causes the bug to surface in LWC. Instead, hide the elements using normal CSS (or SLDS). Here's an example fix:



            <aura:application extends="force:slds">
            <aura:attribute name="value1" type="String" access="private" />
            <aura:attribute name="value2" type="String" access="private" />
            <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
            <div class="!v.value1 eq 'a'?'':'slds-hide'">
            <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
            <div class="!v.value2 eq 'b'?'':'slds-hide'">
            <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
            </div>
            </div>
            </aura:application>


            Avoid Usage of LWC Components



            Using any component that is a LWC component (basically anything in the lightning namespace) can result in this error. You can replace it with the basic ui namespace component (e.g. ui:inputText instead of lightning:inputText). This will probably not be practical in most applications, but it is a possible workaround.



            This has been filed as W-5722782.






            share|improve this answer

























              4














              This is a bug with access checking in the Lightning Web Component framework, and may manifest as an error in Aura components when this happens. There are a few different ways to reproduce it; the one in the answer is just one form. The known solutions are as follows:



              Make The Attribute Public



              The access exception will only occur on private attributes.



              Avoid aura:if



              The way aura:if rerenders causes the bug to surface in LWC. Instead, hide the elements using normal CSS (or SLDS). Here's an example fix:



              <aura:application extends="force:slds">
              <aura:attribute name="value1" type="String" access="private" />
              <aura:attribute name="value2" type="String" access="private" />
              <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
              <div class="!v.value1 eq 'a'?'':'slds-hide'">
              <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
              <div class="!v.value2 eq 'b'?'':'slds-hide'">
              <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
              </div>
              </div>
              </aura:application>


              Avoid Usage of LWC Components



              Using any component that is a LWC component (basically anything in the lightning namespace) can result in this error. You can replace it with the basic ui namespace component (e.g. ui:inputText instead of lightning:inputText). This will probably not be practical in most applications, but it is a possible workaround.



              This has been filed as W-5722782.






              share|improve this answer























                4












                4








                4






                This is a bug with access checking in the Lightning Web Component framework, and may manifest as an error in Aura components when this happens. There are a few different ways to reproduce it; the one in the answer is just one form. The known solutions are as follows:



                Make The Attribute Public



                The access exception will only occur on private attributes.



                Avoid aura:if



                The way aura:if rerenders causes the bug to surface in LWC. Instead, hide the elements using normal CSS (or SLDS). Here's an example fix:



                <aura:application extends="force:slds">
                <aura:attribute name="value1" type="String" access="private" />
                <aura:attribute name="value2" type="String" access="private" />
                <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
                <div class="!v.value1 eq 'a'?'':'slds-hide'">
                <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
                <div class="!v.value2 eq 'b'?'':'slds-hide'">
                <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
                </div>
                </div>
                </aura:application>


                Avoid Usage of LWC Components



                Using any component that is a LWC component (basically anything in the lightning namespace) can result in this error. You can replace it with the basic ui namespace component (e.g. ui:inputText instead of lightning:inputText). This will probably not be practical in most applications, but it is a possible workaround.



                This has been filed as W-5722782.






                share|improve this answer












                This is a bug with access checking in the Lightning Web Component framework, and may manifest as an error in Aura components when this happens. There are a few different ways to reproduce it; the one in the answer is just one form. The known solutions are as follows:



                Make The Attribute Public



                The access exception will only occur on private attributes.



                Avoid aura:if



                The way aura:if rerenders causes the bug to surface in LWC. Instead, hide the elements using normal CSS (or SLDS). Here's an example fix:



                <aura:application extends="force:slds">
                <aura:attribute name="value1" type="String" access="private" />
                <aura:attribute name="value2" type="String" access="private" />
                <lightning:input value="!v.value1" label="Value 1" placeholder="Enter 'a'" />
                <div class="!v.value1 eq 'a'?'':'slds-hide'">
                <lightning:input value="!v.value2" label="Value 2" placeholder="Enter 'b'" />
                <div class="!v.value2 eq 'b'?'':'slds-hide'">
                <lightning:input label="Value 3" value="!join(' ',v.value1,v.value2)" />
                </div>
                </div>
                </aura:application>


                Avoid Usage of LWC Components



                Using any component that is a LWC component (basically anything in the lightning namespace) can result in this error. You can replace it with the basic ui namespace component (e.g. ui:inputText instead of lightning:inputText). This will probably not be practical in most applications, but it is a possible workaround.



                This has been filed as W-5722782.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 23 '18 at 8:24









                sfdcfox

                248k11189424




                248k11189424



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Salesforce Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f244533%2fwhy-am-i-getting-access-violation-errors-when-nesting-auraif%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown






                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay