Posts

Showing posts with the label bugs

The mysterious case of being unable to debug a .Net Core Console application using Visual Studio 2017

Image
This morning I had a very frustrating time. It started off well and I was continuing my drive to convert alot of our hardware services from .Net Framework over to .Net Core. Phase 1 is simply .Net Core running on Windows but then Phase 2 is true cross platform. To date its gone very well and I'll probably write about it further another time. This morning I was continuing to port code across, mainly making our libraries .Net Standard 2 or .Net Standard 2.0 with .Net 4.5 multi targeting. All worked fine until I converted my final library. The app built, it ran and seemed to be working fine however all of a sudden none of my breakpoints in Visual Studio worked. During this entire process I have found I've hit many build / compile issues when switching between branches and have often had to nuke my obj folders or do a git clean -xdf but this was not the case. Everything worked bar the breakpoints. The usual tricks didn't work, I even reboot my machine and then checked out t

UWP WebView Intermittently Fails to Load in a Xamarin.Forms App - Resolved!

As I've previously mentioned I've been porting an existing Xamarin.Forms app over to UWP and tonight I've had to tackle an annoying bug which was quite difficult to overcome and I thought worthwhile sharing. The bug occurs when loading WebViews with HTML directly rather than a URL. I found that roughly 1 in 5 page loads ended up a blank page being rendered. As this is now the third platform for the App I was fairly confident the html and everything was correct. First of all I suspected a layout issue and maybe the width/height was being messed up so I added a background colour to the control but this always rendered. So not a layout issue. A quick Google led me to Johan Karlsson's post on events needing to be added on the main UI Thread  this seemed better at first but i ended up still hitting the issue 1 in 10 page loads.  More googling led me to a Xamarin bug with the issue  but no resolution :( Taylor Buchanan comments on the bug with a work around however I

An unexpected exception which resulted in a gentle reminder of how Linq works...

Image
Tonight I spent some time continuing my port of a Mobile Application I developed a few years ago over to UWP. As it was built in Xamarin.Forms , which also supports UWP, so far its been a fairly straight forward process. During testing tonight however I kept getting an uncaught exception every time I tapped a list item. Specified argument was out of the range of valid values - Source Xamarin.Forms.Core Nasty Exception Now first I double checked the code and found UWP, iOS and Android all run the same code and nothing had changed, so I hadn't accidentally broken anything. What I did note was the pages that didn't have grouped list items worked fine, where as grouped lists always crashed. This lead me to take a look at my ItemSource code for the listview. My ListView ItemSource Now those observant might notice in the pic I'm inspecting the listingNavigationItems, and like I might have realised the potential issue. Dependent on whether grouping is enabled I eith

The curious case of hidden form fields changing their value....

So today I was looking into an odd issue our CEO experienced using a website. He would get a password reset email and upon following the link and entering a new password it would fail to change with a cryptic message. I said I'd have a quick look and see what I could see. I signed up and triggered a password reset and found no issue. I was using Chrome and assumed he had but it turns out he was using Safari on his Mac not Chrome. So I loaded up Safari on my Mac and used my link to again find no issue. To be thorough I asked him to send me his link, in Chrome no issue however this time in Safari I hit the issue. My first thought led me to then check what was posted to the server and sure enough in Chrome I could see an encoded access token sent but in Safari I saw my email address sent. I tried this on my CEO's machine and his machine posted his email address, it looked like Safari was autofilling hidden form fields as well as visible ones! This is crazy! So I performed

Base64 Images with Xamarin.IOS

Today I was adding the ability to render Base64 encoded image strings to my iOS application which is built using Xamarin.iOS. These images are just small thumbnails and are stored in a small database within my app. Since iOS 7 it's really easy to render these as UIImage's inside an UIImageView, in objective-c you simply do something along the lines of: NSData* data = [[NSData alloc] initWithBase64EncodedString:base64String options:0]; UIImage* image = [UIImage imageWithData:data]; With Xamarin.IOS this would translate to: var image = new NSData(base64image, NSDataBase64DecodingOptions.None); var uiImage = UIImage.LoadFromData(image); However running this gives you the following exception: System.Exception: Could not initialize an instance of the type 'MonoTouch.Foundation.NSData': the native 'initWithBase64EncodedData:options:' method returned nil. Ouch As this exception is within the NSData class which is a class that Xamarin generates to map