Forum Visual Studio

Xamarin Debugger with IOS project. Lots of issues.

I've been porting a rather large project from XNA to IO using MonoGame and the Xamarin Studio - and it's been an exciting and often frustrating time.

I've run into functional failures, outright crashes and just plain Stuff That Doesn't Work All The Time - and I thought you'd want to know about it so you guys can look into it. I'm using

Here's a run down of some of the stuff I've noticed.

1) You cannot mark files with a build action at the directory level. As I said, I'm porting an existing project and it has LOTS of assets, all carefully arranged in quite deep directory structures. The only way I have found of setting the build action is to select each and every file and mark it. That means opening up each and every directory structure and doing that. That's not fun. If I could simply select a directory in the project and mark it that way, that would be a serious win for me.

2) I was told that if I put assets in to the Resources directory, they would automatically get marked as Bundle Resources in the Build Action. That might be true if I physically put them in the actual Resources Directory in the project - which I cannot do since I don't own these resources and I cannot move them around in the root directory - but if you just add a folder under the Resources directory in the project, in Xamarin Studio, nothing gets marked as Bundle Resource. I still have to make them all individually. Don't know what is going on there.

3) Move does not work. Some of the time it outright crashes, most of the time it just does nothing. I am attempting to move a reference to a physical directory in the project from one folder to another, using the move function, but nothing at all happens, or a I get a stack trace. (which I apologize for not including here. I should have recorded it when I saw it.) No idea why.

4) If you delete the reference to the Resources directory, the IDE will not allow you create another one. It took me a few days of back and forth to understand that because the physical Resources directory still exists in the project on disk, the IDE won't let me create another one. I simply didn't understand why I was getting the error message I was when I was trying to create a new folder. Not sure what you can do about this to make this more obvious?

5) Exception handling / Debugging. Given the codebase is just littered with try catch exceptions, it would be nice if the debugger handled them correctly. Most of the time, when I am stepping into a function where I know an exception is going to happen, the debugger does NOT step me into that function, it just goes straight to the catch. This is unhelpful, for obvious reasons. This happens even when the exception is happening several functions deep from the function I want to step into. About the only way I can get around this is to put a break point directly in the function being called, and that stops it. Either way, stepping in when exceptions are being fired appears to give the debugger serious issues. And given how much of the code base IS try/catch oriented, you can see how much of a problem this can be.
I have found the Break on Exceptions settings, but it gives you a list of exceptions to break on and that's not that helpful bearing in mind quite a lot of the catches are for generic exceptions - basically I have no idea what I'm supposed to break on, since the catch itself - where the exception is being caught - is for extremely generic catches. Without knowing what the actual throw was, it's hard to know what to put an exception break point on.
This is more a problem with how the codebase has been architected - someone is very attached to Try Catch, to the point where the code base has lots of nested try/catch hierarchies and very difficult to trace / debug.

6) Most of the time the locals variable window is just not populated. Usually when I start up Xamarin Studio, start debugging, it works. Then something happens during the session (after I've been debugging, stopped and gone back to editing, rebuilt and restarted) and it stops being populated and nothing will make it work again. The only thing I can do at that point is mark variables in the Watch window, which will still update.

7) What does Immediate Mode do in the debugger? I'm imagining it must be like the console debugger in XCode? What is the syntax to use it? I can't find any documentation on it. A link on how to use it would be great, thanks!

8) The content build pipeline. Where to begin with this. The words "Absolute mess" don't even begin to cover this. I spent two hours last night on skype with one of the architects of the IOS version of this, and it took us two hours just to get the content build to output anything specifically IOS related.
Some learning that I think needs to be disseminated - the content pipeline will not do automatic power of two conversion of assets that are NOT power of 2 (which, of course, none of ours are), despite the settings you can set in the content pipeline per asset (that setting is not actually hooked up to anything behind the scenes - I went through the code last night). However, if your assets are already power of 2 (as they automatically are in the case of SpriteFont definitions) then yeah, compression happens. Otherwise it does not.
Also, in my case, even though I had XNA 4.0 installed, the content build system requires a higher version of XNA - but since MS is not actively developing that, you have to install the Windows 7 mobile SDK version 7.1 - assuming you can find it, since MS isn't actively distributing it any more - (and it's update of 7.1.1) which has the XNA upgrades that are required before drop downs actually appear in the Visual Studio 2010 content build project. Yeah. And I had to just Work That Out via googling for an hour when the provided projects didn't work.

So say this pipeline process is a mess is putting it mildly.

Now I also get that this isn't anyone at Team Xamarin's fault either. You guys didn't create this CF of a pipeline and I somewhat suspect you guys would like 5 minutes in a dark alleyway with the architect of this, just like I would - but the fact that it's as messy as it is to try and port this to IOS is just... not optimal. I mean, having to edit project files with a text editor? Really?


  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai
    edited March 2013

    1) You can use select multiple files at a time, right-click, and then set the Build Action. If that's not enough, feel free to file a bug requesting the ability to right-click on folders to set the Build Action on all child files (should it be recursive?).

    2) There was a bug in Xamarin Studio 4.0 and 4.0.1 that was fixed in 4.0.2. If you experienced this in 4.0.2, could you file a bug report? I'll try to look into it for the next release.

    I was probably the one who told you it'd work but I didn't realize at the time that my patch to fix that didn't make it in time for 4.0 (and 4.0.1 was just 4.0 with some hotfixes).

    I know I told someone that it'd work and then later found out it wouldn't, but by that time I had forgotten who I had told and where I told them.

    So if it was me, sorry about that.

    3) Moving folders does seem to be a bit buggy but I didn't get a crash, I just got other weirdness.

    Could you file a bug with your crash? I'll file a bug about files not being added to the project after the move and old directories being left behind (and remaining in the project).

    4) Could you file a bug report about this? Maybe it can be made to be more obvious.

    5) This sounds like a Mono Runtime bug. Stepping into a method should step into the method and not end up in a catch from an exception thrown by the method you tried to step into.

    6) I have never seen this and I do a lot of debug, stop, edit code, rebuild, debug, step through some stuff, stop, edit code, rebuild, etc cycles when working on Xamarin Studio.

    Feel free to file a bug, though, but it would be really helpful if you could find a way to replicate this.

    7) It's just an expression evaluator console that evaluates C# expressions given the current stack context. Just be aware that it's rather primitive (at least right now). It can't do LINQ, loops or extension methods for example.

    It has the same evaluator backend as the Watch window.

    You can add named variables to your context, however.

    var foo = mylocal + 5

    Any future reference to "foo" in the console will reuse the value assigned to it.

    8) You might need to elaborate on what the content build pipeline is because I'm totally lost. Is it MonoGame/XNA specific or something?

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    Actually, is this the drag & drop crash you saw?

  • JakeSimpsonJakeSimpson USMember

    It was me you told that to:) Not to worry - I could at least get my content in, even if it took a while. Having at least SOME pipeline to get stuff in is far far superior to having awesome methods that don't work at all:)

    I will endeavor to find a way to replicate 6 - it seems to happen to me a lot, so I'm confused as to why it never shows up for you. I don't think I'm doing anything very bizarre?

    I would absolutely love to push some error reports through - I have no idea how? Can you give me a link? I mean, for all the complaining I am doing here, this IDE is actually very functional. More so, for it's maturity, than XCode even is.

    The expression evaluator actually sounds very useful - you don't have to do Linq and all that to be useful and display the contents of structures and so on.

  • mhutchmhutch USMember, Xamarin Team Xamurai

    Our bug tracking site is - it still uses the old names, so Xamarin Studio bugs should be filed against MonoDevelop. Thanks!

Sign In or Register to comment.