Announcement

Collapse
No announcement yet.

[OPEN] [#2306] Cannot read property of undefined

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [OPEN] [#2306] Cannot read property of undefined

    Hello, I've started with Bridge.net few weeks ago. I was trying to create some simple program to see if it works, but there's a problem.

    I have folder Logic with some .cs files with classes, but I can't access them. Here's a screenshot:



    When I try to call any method, create new instance of it, or anything other, I receive this exception. How can I fix it? Here's screenshot of folder in VS Solution Explorer:

    Last edited by geoffrey.mcgill; 2017-01-29 @ 04:55 PM.

    #2
    Hi,

    We need test sample which reproduces the issue
    For example, you can upload your project to some public git repository and we will review it

    Comment


      #3
      Or better yet, a link to a Deck that demonstrates how to reproduce the error.

      Comment


        #4
        Here's link to Git: https://github.com/SoptikHa2/The-Bla...20Black%20Hunt

        The problem causes App.cs, method Main(), lines 14 & 15.

        Comment


          #5
          Is it because you are not including the_Black_Hunt.bridge.logic.js in your .html page?

          Can you simplify your sample down to just the minimum amount of code required to reproduce the problem? When I simplify, and include the_Black_Hunt.bridge.logic.js, the page runs as expected.

          Comment


            #6
            Might also be an issue with your Assembly name. You should remove the spaces, or replace with dots.

            Recommended Naming Convention:
            https://msdn.microsoft.com/en-us/library/ms229048.aspx

            Click image for larger version

Name:	Screenshot 2017-01-29 13.38.22.png
Views:	1
Size:	16.5 KB
ID:	3389

            Hope this helps.

            Comment


              #7
              I suggest to use combineScripts option in bridge.json (see http://bridge.net/docs/global-config...combineScripts)
              In this case, Bridge will combine all scripts to one file (including bridge.js)

              Comment


                #8
                I've added a new version of my project to Git. The 'Cannot read property of undefined' is fixed (thank you!), but there are 2 more exceptions:

                - Uncaught SyntaxError: Unexpected identifier (The Black Hunt.bridge.logic.js (3240))
                - Uncaught TypeError: Cannot read property 'Logic' of undefined at $main (the Black Hunt.js (91))

                First exception (at javascript file the_Black_Hunt.bridge.logic.js):


                Second exception (C# file App.cs, method Main):
                new Weapon("", "", 0, 0, 0, 0, 0);

                Comment


                  #9
                  The problem occurs because you use Bridge as part of your namespace, for example `The_Black_Hunt.Bridge.Logic`. It forces errors of bridge resolving system. I suggest do not use `Bridge` as entity name or part of namespace. So, to resolve the the issue just remove Bridge from namespace everywhere

                  We will try to fix such issues in the next releases
                  Git issue has been opened: https://github.com/bridgedotnet/Bridge/issues/2306

                  Comment


                    #10
                    It works, thanks! I've moved the Logic folder outside Bridge folder and it works now! Thanks :-)
                    Last edited by geoffrey.mcgill; 2017-02-13 @ 07:39 PM.

                    Comment

                    Working...
                    X