Johan Karlsson Blog
178 FOLLOWERS
A blog about mobile development and related technologies. Nothin' fancy! Mostly using Xamarins stuff.
Johan Karlsson Blog
4y ago
Alright, so this is completely new ground for me. I've never written any kind of dynamic query function for real before. At least not where I also had to design the indexing functionality. I'm writing this part of the test even before I've started to write any code at all since I need to get a grip of the requirements here.
Later on, I do need to add some kind of schema support to divide different types of entities from each other. At the moment, I'm just going to ignore that fact and treat the data as a single entity. From a tech perspective, it's the same thing if it's one or multiple entit ..read more
Johan Karlsson Blog
4y ago
So this is what I got so far. On the left side, we have a REST API with support for GET using an Id and two POST implementations.
One of the POST implementations needs an explicitly defined Id in the route, the other will use reflection to get the id from the content. At the moment, it just looks for a property named 'Id', but it should be definable later on if this is something that will stand the test of time.
The Core.Client is the coordinator at the moment for reading and writing data to some kind of storage. I've implemented two basic variants; an InMemoryReader/writer and a FileReade ..read more
Johan Karlsson Blog
4y ago
It's been a while since I've blogged. About 2,5 years to be exact. Historically, this blog was all about Xamarin but I've decided to expand the surface area to just about anything regarding coding, electronics, and development. There will still be a lot of Xamarin of course.
In my current assignment, I've been doing a lot of backend development and have stumbled across many different data sources.
I must admit that I haven't worked with document databases before and honestly thought that all of this NoSQL-stuff was kinda weird. Now, I've changed my mind and also included document databases i ..read more
Johan Karlsson Blog
4y ago
There are some reports of VS for Mac crashing during install. I got to experience this first hand this weekend. The solution for me was to fire up the terminal and run the installer using sudo.
Step 1
Given that you have the installer image mounted and a terminal running.
Navigate to /volumes/Install Visual Studio for Mac.app/contents/MacOS
Step 2
Run "sudo ./Install_Visual_Studio ..read more
Johan Karlsson Blog
4y ago
A quick tips/workaround. I'm sure Xamarin will address this issue shortly.
Problem
The app crashes on start up on Android 8 with the error message
[] * Assertion at /Users/builder/jenkins/workspace/xamarin-android/xamarin-android/external/mono/mono/mini/mini-arm64.c:878, condition `ji' not met
Updated solution (the real solution)
It was actually the usage of the dynamic keyword that caused the crash...
Solution (kept for historical reason)
Uncheck "Use Shared Mono Runtime" under "Android Build ..read more
Johan Karlsson Blog
4y ago
TLDR;
If you are hooking up events for a Xamarin Forms WebView, wrap the hooking up in a Device.BeginInvokeOnMainThread if you experience a blank WebView. I've seen this issue mostly on UWP.
public MyView()
{
this.InitializeComponent();
Device.BeginInvokeOnMainThread(() =>
{
// Hook up events in here
this.myWebView.Navigating += a ..read more
Johan Karlsson Blog
4y ago
I've tried AutoMapper on numerous occasions and it's a great product. However, my mind seems to work a little bit different so I usually use a little different approach. I want to be able to follow my mappings so what I end up doing is to write the mappers by hand. (#bad)
I do give AutoMapper a try from time to time, but I still favour this way of doing it. It's just a personal preference!
If you haven't heard of Automapper, check it out at http://automapper.org/ before you embrace this technique! :)
The pattern I use for this is simple (and the magic lies in the simplicity of it ..read more
Johan Karlsson Blog
4y ago
This is one of those short stories...
TLDR;
If you get a RFLCT_Ambigous exception in your UWP app in Release configuration on the initialization of the autogenerated service client that Autorest created for you then simply update the Microsoft.NETCore.UniversalWindowsPlatform package.
The issue does not arise in debug mode.
Long version
I'm ashamed... I spent way to much time on this issue before I tried what I should've tried the first time I saw the error.
Always update your nuget-packages before trying to solve an issue related to some other persons code. Oh, and always do so in ..read more
Johan Karlsson Blog
4y ago
If you want to insert a new root element on a content page (using Xamarin Forms) you must set the Content to null first before assigning it again. Otherwise touch events will not register (at least not on iOS).
For example, add the entire view in an AbsoluteLayout could look like this:
// Get a reference to the content
var content = page.Content;
page.Content = null; // This line is key
// Create a new root element and add the content
var ..read more
Johan Karlsson Blog
4y ago
This cost me the better part of a day to investigate since I tried everything else but recreating the project.
How I messed up
I had an ASP.NET Core WebApi project that I simply upgraded to .NET Core 2.0 by changing a line in the configuration from
<TargetFramework>netcoreapp1.1</TargetFramework>
to
<TargetFramework>netcoreapp2.0</TargetFramework>
What happened
Visual Studio (2017) pretty much hanged and/or performed extremely slowly. When loading the solution VS took about 2 minutes to load the web project.
How did I resolve it
Simply recreate the web project ..read more