20 Replies Latest reply on Jan 24, 2007 12:09 AM by Cédriic

    Breakpoints broken?

    BrianFarrell
      Have been using FB2 since release now and am liking it a lot, especially the debugger. In the past I have been able to set breakpoints and the debugger would 'break' at them provided they were not inside an event handler script. Now I can't get the debugger to break at all. I have tried putting breaks in just about every place I know off but it just ignores them and carries on running. Is there some setting somewhere I may have inadvertantly flipped or are others experiencing this same problem?

      Using Eclipse 3.2 with latest FB under WinXP with 3.5Gb ram, 3.2GHz Dual P4 etc
      Brian
        • 1. Re: Breakpoints broken?
          David_S_deB Level 1
          Also getting the same problem, the debugger wont break at the break points. I end up having to set a temp variable to null and then calling that variables .ToString() method to cause a null pointer exception just after the point I want to break... not elegant, but it works.
          • 2. Re: Breakpoints broken?
            BrianFarrell Level 1
            Thanks for confirming David although I'm not sure what we have confirmed.

            I was using a similar workaround myself.
            • 3. Re: Breakpoints broken?
              mike_morearty Level 1
              That's bizarre. I can't think of anything that would cause that. Try cleaning and rebuilding the project (Project > Clean).

              Did you accidentally toggle "disable all breakpoints" -- one of the buttons in the Breakpoints view? If so, then the blue-circle icon for breakpoints will have a big slash through it.

              If it's not that, then tell me, after you begin debugging, how to the breakpoint icons show up? Is it blue circle? Blue circle with small red "x" over it? Blue circle with checkmark?

              Are you using the "Source Path" feature, where some sources are on the source path rather than being directly in your project? (Project properties, Flex Build Path, Source Path.) At some point there were known issues with that.
              • 4. Re: Breakpoints broken?
                mike_morearty Level 1
                One other possibility: As described on http://www.adobe.com/support/documentation/en/flex/2/releasenotes_flex2_fb.html , a known bug in the 2.0 release is this:

                "The debugger doesn't stop at breakpoints when using <script src="XXX"> to point to files located in subfolders - The workaround is to temporarily move your scripts out of the subfolder or to put them inline in a Script block in the MXML file."

                Is that what is happening?
                • 5. Re: Breakpoints broken?
                  Chielosos
                  Thanks for the solution :) Athough I still hope that this will get fixed very soon (I hate having all my files in the main dir or, even worse, having all my script code included with the main MXML file), this will help me out a lot. I spent hours on finding out why the debugger wouldn't stop at my breakpoints, thinking I was doing something very wrong... Are there any known release dates for bug fixes? That way I could decide if I want to change my whole setup or not ;)
                  • 6. Re: Breakpoints broken?
                    Chielosos Level 1
                    Quick workaround (not the prettiest, but works for me):

                    Add:

                    <mx:Script>
                    <![CDATA[
                    // spot for debug code
                    public function debug_me(): void
                    {
                    // fake content
                    }
                    ]]>
                    </mx:Script>

                    to your main MXML file and set a break point on the line with the "fake content" comment.

                    Now trigger the function debug_me() from some place else and It'll work. For as far as I tested, that is :)
                    • 7. Re: Breakpoints broken?
                      parallaxed Level 1
                      Hi,

                      I'm having a similar problem which is bugging the hell out of me - Flexbuilder refuses to stop at any breakpoints set in the Source Path. Is there any workaround for this?

                      Alternatively is there some way I could reorganize my source tree such that I don't have to use the feature that's causing the problem?

                      Currently I have
                      - <flexProject>/
                      - <flexLibraryProject>/
                      - src/com/myappdomain/....

                      All of my projects simply include the src/ directory to get access to Custom class files in that package. Am I doing this wrong? I tried setting it up such that projects could come straight out of that package folder hierarchy, but it threw errors about projects already being under that source path and refused to create them.

                      I'd rather keep all the source in the same place for packages that share the namespace if possible. If I'm doing it wrong though I'd like to know.

                      Any clues would be much appreciated =)
                      • 8. Re: Breakpoints broken?
                        parallaxed Level 1
                        The workaround above does the trick for a lot of stuff, I guess I meant to use the word "patch". In some cases I've found merit to declaring debug_me() as static. Though I'd still like to know if I'm using the source path feature correctly (if i've organised my folders in line with "convention")...
                        • 9. Re: Breakpoints broken?
                          Chielosos Level 1
                          It's just a workaround indeed... Guess we'll just have to hope Adobe releases a proper patch to address the file path bug, 'cause I'm just not moving all my files to a root dir (which doesn't even work as far as I know). Messing up a project because the debugging facility is slightly buggy... no, thanks :) But for the time being, I'll use this approach. BTW, if you add a parameter to the debug_me function declaration (something like debug_me(obj:Object)), you can send along an object that will show up immediately in the debug console (with the 'obj' name). Works quite well.
                          • 10. Re: Breakpoints broken?
                            justinmschell
                            If you are having problems with breakpoints failing in external files (i.e., those referenced by your build path), try removing all build path entries as well as their corresponding directories in the project's bin directory. Once you add your build path entries back, your breakpoints should work. At least this worked for me when I was having this problem.
                            • 11. Re: Breakpoints broken?
                              cluebcke Level 1
                              The same thing has happened to me. I am not using <script src="">, nor do I have anything configured in my source path. I've added some additional swcs to the library path, but since there were half a dozen from the sdk to begin with, I'm doubtful that's the cause.

                              The debugger will not launch on a breakpoint, even one set on the first line of the creationcomplete handler in Main.mxml.

                              Mike, I don't want to sound like a jerk, but the debugger is one of the features that justifies the rather significant cost of this product. Clearly a number of people are having problems, and I suspect we'd all appreciate some dedicated attention from Adobe on this problem. I've searched flexcoders and the web up and down and am unable to find a resolution, and it's really, really hurting right now.
                              • 12. Re: Breakpoints broken?
                                cluebcke Level 1
                                Oh also, cleaning and rebuilding had no effect
                                • 13. Re: Breakpoints broken?
                                  cluebcke Level 1
                                  Bump. Maybe if I bump this up every Monday it'll get some renewed attention from the FlexBuilder team....
                                  • 14. Re: Breakpoints broken?
                                    mike_morearty Level 1
                                    Chris, the upcoming 2.0.1 dot release has fixed the problem that I referenced.

                                    But just to be sure I've fixed your case, can you please post (on this thread) a small sample that shows exactly how your project is laid out, with an example of a breakpoint that doesn't work? I can then try it on my build.
                                    • 15. Re: Breakpoints broken?
                                      cluebcke Level 1
                                      Thanks Mike! Here's the information you asked for (and I realize now I could have been more specific in the original post):

                                      Eclipse version: 3.2.1
                                      FlexBuilder is running as a plugin (rather than standalone mode)

                                      Project structure:
                                      /project/flex/Main.mxml
                                      /project/flex/com/x/common/model/ModelLocator.as
                                      ...

                                      Source Path: empty
                                      Library Path: The usual, plus Cairngorm and Flexunit SWCs

                                      In Main.mxml I have the following handler for the creationComplete event:

                                      private function onCreationComplete():void {
                                      trace("Hello");
                                      model = ModelLocator.getInstance()
                                      model.loginState = ModelLocator.LOADING_CONFIG;
                                      // ...
                                      }

                                      I get the trace statement in Sephiroth's awesome Firefox trace panel ( http://www.sephiroth.it/weblog/archives/2006/10/flashtracer_firefox_extensionphp.php if you haven't seen it). Not only that, when I debug from Eclipse I get the trace statement in the console. But when I set a breakpoint on any of the lines in the above function, nothing happens. I opened up the debug perspective and made sure the breakpoint wasn't disabled or anything dumb; it wasn't.

                                      The one thing I haven't tried is uninstalling/reinstalling FB--it hasn't been /that/ bad yet.

                                      Luckily it looks like I'm going to be able to participate in the 2.0.1 beta, so later today I'll reply again and let you know if the problem still persists (I'll make it a clean build, too). You could certainly wait to see if my issue goes away before trying to reproduce this on your own.

                                      Thanks again MIke, appreciate the support. Please let me know if I haven't provided the right information.

                                      - Chris Luebcke
                                      • 16. Re: Breakpoints broken?
                                        mike_morearty Level 1
                                        When you say "/project/flex/Main.mxml", I think you are saying that Main.mxml is your mx:Application, and that Main.mxml is in a directory called "flex" which is in the root of your project, right?

                                        And if you go to Project Properties, Flex Build Path, at the bottom under "Main source folder" it should say "flex", since that is the directory that your Main.mxml is in -- does it? (Or, if you meant to indicate that "project" is the name of a directory inside your project, and "flex" is a subdir of that, then "Main source folder" should say "project/flex".)
                                        • 17. Breakpoints broken?
                                          cluebcke Level 1
                                          quote:

                                          Originally posted by: mike_morearty
                                          When you say "/project/flex/Main.mxml", I think you are saying that Main.mxml is your mx:Application, and that Main.mxml is in a directory called "flex" which is in the root of your project, right?


                                          Boy, I keep making this worse, don't I?

                                          I actually have, under my project's top-level folder, a specific project name (let's call it /project-name/) and then a flex folder under that. My tree in Eclipse looks like

                                          [Fx] <Eclipse Project Name>
                                          -- /<Internal project name>
                                          ---- /flex

                                          All of my Flex/AS source code is under the /flex folder. /project/flex/Main.mxml is indeed my mx:Application, and it's two folders down from the top, not one.

                                          quote:

                                          And if you go to Project Properties, Flex Build Path, at the bottom under "Main source folder" it should say "flex", since that is the directory that your Main.mxml is in -- does it? (Or, if you meant to indicate that "project" is the name of a directory inside your project, and "flex" is a subdir of that, then "Main source folder" should say "project/flex".)


                                          Actually it's blank and always has been (as far as I can recall; I certainly didn't deliberately change it). Although I have my mx:Application in a subfolder (this is a big J2EE project and "com" doesn't make nearly as good a top-level folder as "flex" does), once I put it there and identified it as the application, the builder was able to find all my classes and components in the ./com/company/xxx folders below it.

                                          Since you brought it up I decided to try to set it to the flex folder and see what happened. Nothing good, I'm afraid. First it complained it couldn't find my application file--fair enough, I just right-clicked on Main.mxml and selected "Set as default application" again. However, after doing that the builder seemed unable to locate configuration files and assets that are in a different part of the project--and it still compained that it couldn't find my application file.

                                          After switching the source path back to "", I found one more thing to try, which was the source lookup path in run/debug configuraiton. It included my project, but I did try adding my source folder (/project-name/flex) and setting it as default. No change, unfortunately.

                                          Since I know that Eclipse can connect to the debug player--I get my trace() statements in the Eclipse console--I suppose there's a possibility that my placement of source code is at fault. Everything except this works perfectly fine, and changing the source code path didn't seem to help (and sometimes hurt).

                                          If the issue doesn't go away with the FB 2.0.1 beta, I'll try promoting my Flex source to the top-level project folder and see if that does in fact fix it.

                                          Thanks again,
                                          Chris
                                          • 18. Re: Breakpoints broken?
                                            mike_morearty Level 1
                                            A couple of red flags here. For one thing, in Flex Builder (and Flex itself) it is mandatory that your mx:Application be in the unnamed package, e.g. you can't have com/mycompany/MyApp.mxml with an mx:Application tag. There are good reasons for this, although I can't remember what they are :-)

                                            What Flex Builder *does* allow you to do is to put that Application file -- and all other sources -- in a subdirectory of your project, rather than putting those files at the root dir of the project. But the way you do that is by setting the "Main source folder" in the project properties.

                                            It strikes me as very suspicious that your "Main source folder" is empty, and yet your Application file is not in the top-level directory. In fact, I'm not sure how you got that to compile at all. Basically, if I understand correctly, the way you are doing it is not supported. The mx:Application file must be in the directory that was specified by the "Main source folder" field.

                                            As for locating other assets, well, I'm a little fuzzy on this but I think asset lookup is relative to the "Main source folder" (I may be wrong about this). Put your assets in there. If for some reason you can't or won't put them in there, then you'll need to move your main mx:Application file up to the top level.

                                            Also, the fact that it's a J2EE project is interesting. So it's a single project which has both Java and Flex Builder code? That's fine, nothing at all wrong with that, but still, it caught my attention. Is Flex Data Services compiling the SWF on the server, or are you doing the more common way of having Flex Builder compile the SWF locally? Not sure if it matters; just trying to figure it all out.
                                            • 19. Re: Breakpoints broken?
                                              cluebcke Level 1
                                              Fixed! (Mostly). The changing the source path (and moving my external xml file to under the source tree) did the trick.

                                              I'm still getting the following warning:

                                              Application file <project-name>\flex\<project-name>\flex\Main.mxml does not exist.

                                              When I changed the source folder, the application target in the builder was wrong. However, changing the application target didn't make this warning go away. However, I can build and debug, so I'll beat on this for a little bit before asking for help again.

                                              Thanks so much MIke!

                                              - Chris Luebcke

                                              PS: The file I had to move was not in fact an asset--it's a component manifest. Who knows, maybe I could get mxmlc to find it where it was by using some ../../ thing, but that's just asking for trouble. It's fine in the new location, may in fact be a better spot for it.
                                              • 20. Re: Breakpoints broken?
                                                Cédriic
                                                quote:


                                                Fixed! (Mostly). The changing the source path (and moving my external xml file to under the source tree) did the trick.

                                                I'm still getting the following warning:

                                                Application file <project-name>\flex\<project-name>\flex\Main.mxml does not exist.



                                                I had the same problem yesterday. Here is my method to re-build the project properly :
                                                - delete the project without deleting the file contents.
                                                - create a new project : File > New > Flex Project
                                                - in the wizard window : Basic > Choose Project Name. Then, don't click on Finish but click on Next. SPECIFY HERE THE MAIN SOURCE FOLDER.

                                                Everything should come back as you want : with no more warning problems and no more breakpoints problems.