Happy New Year!

We’ve just come to an end of a decade, it’s amazing how time just flies by. Here’s to great new year and an even greater decade.

Enabling CORS Support in .NET Core 3.0 Web API

CORS or Cross-Origin Resource Sharing is a web technology that allows cross-origin (read: requests coming from a different domain) API calls and resources to be shared. Typically, browsers protect against cross-origin calls but with CORS enabled, your browser will allow these requests when certain header values are returned by the request. This is especially useful when making AJAX calls to another domain’s API. When you are consuming someone else’s API, this technology has likely already been enabled on their end, but what about if you are writing your own Web API? Fortunately, development frameworks such as .NET Core have CORS support builtin via middleware. Microsoft provides some solid documentation on it here:https://docs.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-2.2, however, this only works up to .NET Core 2.2. If you are working with .NET Core 3.0 like I am, you will notice that the listed instructions for enabling CORS does not work. This actually has to do with the order of the setup calls being made, and which methods they are made in as shown in this issue on GitHub: https://github.com/aspnet/AspNetCore/issues/16672

The correct way to enable CORS in .NET Core 3.0 is as follows. Note that this configuration does the following:

  • Allows any origin (making the API fully accessible to any website or program that wants to call it
  • Allows any HTTP method whether it be GET, POST, PUT, OPTIONS, DELETE, etc
  • Allows any headers like Content-Type, Authorization, etc

You can limit these by explicitly listing which methods, headers, or origins you want to use, take a look at the Microsoft documentation for the syntax (it’ll still work in Core 3.0 as long as you follow the correct order below).

        public void ConfigureServices(IServiceCollection services)
            // Setup services (use AddCors after AddControllers and before AddMvc)

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
            if (env.IsDevelopment())


           // This call MUST be made between Routing and UseAuthorization
           // For your API to be completely accessible to any public consumer, you should allow requests from any origin
           // You can add restrictions for allowed methods and headers, but in this case we want to allow them all
                options => options.SetIsOriginAllowed(x => _ = true).AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()


            app.UseEndpoints(endpoints =>

Xamarin Tips and Tricks: Uploading iOS App Archives using Xcode

Xcode 11 drops support for Application Loader which was the de facto standard for uploading apps whether they were developed natively or through a cross platform framework like Xamarin. Microsoft has since updated their documentation to show how to upload apps directly via VS for Mac: https://docs.microsoft.com/en-us/xamarin/ios/deploy-test/app-distribution/app-store-distribution/publishing-to-the-app-store?tabs=macos

While this method seems convenient, it involves some additional setup. Since VS for Mac is a 3rd party application that needs to access information related to your Apple ID, you’ll need to generate an app specific password for authentication. This sounds easy, but you should note this also requires 2FA enabled on that account. I am a strong proponent for 2FA, but this may not work out so easily for everyone such as when your development device uses a different Apple ID than your Apple Developer associated Apple ID.  Fortunately, there is a workaround using Xcode’s app distribution feature If you are logged into your development Apple ID in Xcode (Xcode > Preferences > Accounts), you can actually upload directly through the Organizer (Window > Organizer). As long as you have already generated the archive for publishing under VS for Mac, your archive will show up under the Xcode Organizer and you can sign and distribute the app via the usual channels (App Store, Ad Hoc, Enterprise).

Screen Shot 2019-10-15 at 8.59.18 AM

Issues with push notification device tokens on iOS 13 (including a fix for Xamarin)

While I was trying to fix some issues with push notifications on a backend system I noticed that the device token being generated from my iPhone X running iOS 13.1 looked quite strange as it was returning something that looked like this:

{length = 32, bytes = 0x965b251c 6cb1926d e3cb366f dfb16ddd … 5f857679 376eab7c }

When I was expecting it to look more like this:

<965b251c 6cb1926d e3cb366f dfb16ddd e6b9086a 8a3cac9e 5f857679 376eab7C>


I soon found out, thanks to the articles listed below, that there is a breaking change in the way device tokens are accessed on iOS 13:



The fixes for Swift and Objective-C are provided, but what about for Xamarin? Thanks to Stack Overflow, we have the solution for that as well:


Note that this solution doesn’t take into account the formatting for iOS versions below 13, which is why I have written a code snippet that does:


There’s actually another issue that is causing problems with iOS 13 which has to do with the new apns-push-type. I will go over that in another write up, but for now I recommend reading the article from One Signal as it goes over this. As always, thanks for reading.

WWDC ’19 Round-up

Although I wasn’t able to make it to WWDC this year, here is a quick roundup of some of my favorite things announced:

iOS 13 and iPadOS

iOS 13 sees some evolutionary improvements and new features, big ones including Dark Mode and Sign In with Apple. iPadOS brings a revamped OS designed for the larger displays offered on across the iPad lineup. I honestly wasn’t expecting a new OS for the iPad but damn it look fantastic. Features like a full file manager and downloads in Safari brings the iPad one step closer to replacing laptops for many users.


macOS Catalina

In addition to the crossover of unified iOS apps into macOS and the ability to ship iPad apps to macOS, one killer feature that really wowed me was Voice Control. The demo video is simply mind blowing and really show how far Apple has taken user accessibility. This feature goes a step further and works across macOS and iOS. Take a look at this demo, just wow: https://www.youtube.com/watch?v=aqoXFCCTfm4


iOS Development Tools

SwiftUI looks like a game changer. A WYSIWYG interface builder with code generation, live previews, and declarative syntax? Yes please! https://developer.apple.com/tutorials/swiftui/tutorials


Mac Pro and Pro Display HDX

We go back to the cheese grater Mac Pro era with the latest evolution of the Mac Pro. Up to 28 cores, 1.4TB of RAM, 4TB of blazing fast flash storage, and a 1400W power supply. I need one of these, along with the $6000 6K Pro Display and it’s $999 stand. Yeah its pricey but oh man it has been such a long time since Apple has released such a great looking piece of pro hardware.

Lenovo ThinkPad E570 Review

I have been an avid MacBook Pro user for the past 5 and a half years. After purchasing my first MacBook Pro in 2013 I thought I would never buy another Windows laptop again after the nightmares I had with them. Yet here I am, reviewing a ThinkPad. I bought this solely as a work machine since I simply needed a dedicated portable Windows development environment. I do put my Dell desktop to good use but it isn’t portable and I travel quite often so it became more of a necessity than a want. After an hour or so of research I came across the ThinkPad E570. I have always held ThinkPads with high regard, with my first experience messing around with my dad’s IBM ThinkPad when I was a kid. The TrackPoint was the coolest little thing to me. Since then coworkers have held the latest T series to the highest regard, recommending them as the laptop to get sans a MacBook Pro if you need Windows. Considering I spent quite a bit on the 2018 MacBook Pro I figured I keep a tighter budget for my Windows laptop. The E570, and really the E series altogether was something I never heard of. I thought there was the T series and thats it. I figured a Core i5, 8GB RAM, and 256GB PCIe SSD was a decent deal for $630 shipped from Amazon. I soon learned that the E series was the “budget” lineup of ThinkPads and purists say it’s not even really a ThinkPad because the build quality isn’t even close to a T or X series. I figured for the price I can take a chance. Here is a breakdown of some pros and cons:


  • Good specs for $630
  • ThinkPad reliability (or at least perceived reliability)
  • Fast Samsung PCIe NVME storage
  • Decent 1080p 15.6″ display
  • Fingerprint reader for Windows Hello
  • Comes with Windows 10 Pro
  • Good selection of ports



  • Cheap plastics and fingerprint prone matte finish on lid
  • Heavy battery that equates to just ok battery life with mixed use
  • Lenovo junk preinstalled
  • Fans come on quite often and gets pretty hot
  • Wall charger cable is tiny and the connector could be better


Now it may seem that the quality is just as bad as everyone says but hear me out, I can’t really complain much for the price and competing laptops from Dell or HP will have worse build quality and/or specs for this price point. It certainly isn’t a T series and won’t hold a candle to any MacBook (perhaps every) in terms of build and finish but I don’t think it’s worth skipping this computer over. It seems simple to repair and could be durable enough for at least 2 to 3 years of moderate to heavy use. It’s kind of refreshing owning cheaper, plasticky laptop that you can throw around. I have only had this machine for a day so I can’t comment on long term use but I would say I already have a good impression. I would recommend this laptop to anyone with a budget of under $700 and wants the cheapest way to buy into the ThinkPad brand.

Tech update: 2 new laptops!

It’s been a while since I last posted as I have been super busy with classes and a new job I have taken up. The 2 new laptops are as you guessed related to the later. First off is a new MacBook that replaces the Late 2013 that I will likely always regard as my favorite computer I have ever owned. Many fond memories and important projects were made possible thanks to that fantastic machine and will now go on to serve someone else as a refurb. Replacing it is a beefed up 2018 MacBook Pro, configured as 15 inches with a 6-core Intel Core i7, 16GB RAM, 512GB PCIe SSD, and Radeon Pro 555X graphics. I won’t be doing a review since there are tons already out there but in short this thing is pretty damn powerful. It’s still thin and relatively light but my only complaint would probably be the keyboard, its just too loud for a laptop keyboard. The giant trackpad with Taptic Engine is responsive as ever albeit a little too big but not complaining and the lack of ports hasn’t really been much of a problem for me. No more MagSafe is a bummer but its nice to be able to charge on either side. Now, you are probably wondering what the other laptop is and its a ThinkPad! My new job requires a Windows machine and since I travel often I figured why not get a dedicated laptop instead of running a VM. Considering the new MacBook was a pretty penny I went for the more value minded ThinkPad E570 with a dual core i5, 8GB RAM, and 256GB PCIe SSD. I will be reviewing this in another post (only had it for one day). Initial impressions are pretty good and for $630 I’d be hard pressed to find a better built machine from Dell or HP. More to come.