A quick but unknown hack to force referenced assembly to getting copied to a project

Mock Function call to force loading an assembly - how elegant!

Referenced assembly not getting copied to a project in build might lead to surprising runtime errors. This post will explain one method of fixing these issues.

Problem

After build, you might get this kind of error:

In my case, I had referenced both of these DLLs in my “class library project”, which provided my console program a lot of functionality:

  • Microsoft.IdentityModel.Clients.ActiveDirectory.Platform
  • Microsoft.IdentityModel.Clients.ActiveDirectory

Continue reading

SharePoint-Teams -integration using a tab

Microsoft Teams Logo

This post describes one possible scenario for SharePoint-Teams -integration, how to achieve that, and what kind of issues there might be.

Teams? What’s that?

At Blue Meteorite, we at the Valo team have been leveraging Teams since early 2017 as our main communications channel. For us, it complements Yammer, email and Skype for Business quite nicely, although to be fair, it’s not always 100% clear which channel would be optimal for a certain piece of communication… 🙂

The Redmond Magazine calls Teams Microsoft’s response to Slack, and for someone who has used both, the source of inspiration is rather obvious. Built for “high-velocity teams”, it’s yet another collaboration/communication tool, but in a way more flexible than either Skype for Business or Yammer. First and foremost I’d position it as a challenger to services like Slack – and hence at least partially a new addition to Microsoft’s ecosystem.

Continue reading

Fixing the “Could not load file or assembly … or one of its dependencies” error

Visual Studio logo

This post describes how to fix the “Could not load file or assembly ‘<assemblyname>’ or one of its dependencies. An attempt was made to load a program with an incorrect format.” error. 

Problem

Especially while installing a new dev machine, and building your project for the first time, you may end up getting the following exception:

No fear, though, as this is usually easily fixed. In quite a few cases, it’s simply a mismatch between architectures and easily changed.

Continue reading

One web developer’s story about the downfall of web hosting (EIG review) – part 1

EIG is basically a host of scams now.

Okay, so this is going to be a bloggish rant about EIG – Endurance International – a web “hosting” company that’s ruining the web for everyone. If you hate salty rants, browse something else, please.

For a short version, check this out.


I’ve been an independent web developer since around 2004, and even though maintaining and hosting websites is currently more of a hobby than anything else, I still do have a few dozen customers with one or more websites or other systems hosted by me. For more than 10 years I’ve been hosting both my and my customers’ websites on a few different web hosting or cloud providers, and some services on servers I hosted myself. I joined Site5’s customerbase in 2013, after Clients From Hell endorsed them repeatedly (it was a paid promotion – but still, a good word from a trustworthy source). 

Continue reading

Launching a new debugger instance from code in Visual Studio

Sequence contains more than one element

This post describes a quick solution to launching a new Visual Studio instance for debugging the code. Where I’ve found this exceptionally useful, has been in debugging code-first migration’s (one of the ways for database initialiation in .NET) Seed-method. It is by default undebuggable, as when you are running Update-Database you can’t really use a -debug switch or anything, and there’s really no way to launch the debugger. Hence the best you can do is using -verbose to get more information.

However, if you actually want to see what is happening in the code, here’s the solution.

Continue reading

Fixing error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient'”

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

This post describes the fix to error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient'”, which Visual Studio throws at your face when you try to run an application on any Windows-based system (or which you’ve dug out of event logs). Also, you’re probably using Entity Framework in your project.

Error

When debugging/running your code you get an error like this:

The running of the program is stopped there, and removing and readding the nuget packages and/or other references to dlls does not help. I tried also making all kinds of changes to my web.config, but nothing seemed to help. There’s a simple fix available, though!

Continue reading

Using Dispatcher to update values in GUI elements from a background thread

System.InvalidOperationException'

Quick tip:
If you’re developing something like a WPF app and you’ll need to update values on the User Interface based on a long-running operation that runs in a background thread (like depicted here), you’ll probably need to use Dispatcher, or otherwise you’ll run into issues with the GUI elements being owned by another thread, and therefore forbidding access to them. This can result in an error like this:

Luckily, there’s a quick workaround available. Read on!

Cue the Dispatcher

Continue reading

Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

This post describes how to run Entity Framework’s code-first migrations against a database located in the Windows Azure. This is done by running Update-Database commandlet with suitable switches, see below.

The problem and symptoms

Okay, so you’re developing your MVC+EF cool web app with a database in Azure, and you’re using code-first migrations. Cool! What’s nice with code-first-migrations is the fact they are run automatically even in the cloud the next time your app is running (as long as you publish your app with that little box ticked – something like in the screen capture below). But wait – what if there are conflicts – what kind of errors are you going to get?

 

Azure Web Publish

Azure Web Publish

Not very useful ones, I’m afraid, and it’s a pain navigating the Azure portal to fetch the log files. At some point – for me, it wasn’t the first time I ran the web app, but the phase when I was logging in – you’ll be getting the error the migrator internally throws. That might be enough to point you to the right direction, and maybe you’ll be able to figure out what’s wrong! But if that’s not the case, here’s the way to run Update-Database against your Azure Database!

Continue reading

Updating files in an App Part (SharePoint Add-in)

SharePoint_aint_broken

Luckily, SharePoint Add-ins (or App Parts, like they were called earlier) are slowly getting killed and rooted out of all the sites they once were deployed to – and I don’t think anyone’s going to miss them. However, as so often happens with legacy implementations, there will still be thousands of sites, where SharePoint administrators and developers will be responsible for maintaining and developing the solutions further. This will occasionally require updating app parts, which is a process that kind of sucks. Here I’ll try to simplify the process.

Problem(s)

Not all the files in an app part are updated during the deployment and upgrade of the app. This is difficult to debug and leads to new functionality or enhancements not being applied to the target system.

Continue reading

Exception of type ‘System.OutOfMemoryException’ was thrown.

IIS8

This post describes one of the more no-brainerish ways of fixing a ‘System.OutOfMemoryException’ exceptions being thrown in your MVC ASP.Net application using Entity Framework.

Problem

While developing a web project, for example ASP.NET MVC with EF, sometimes when handling a lot of data or complex entities on your dev machine, you encounter this error:

Reason

By default, Visual Studio uses 32-bit version of IIS Express for your deployments. In case you know what you’re doing, it’s safe and easy to change this, though.

Continue reading