Runar Ovesen Hjerpbakk

Science-based software development

Windows

Build 2015 Day One Keynote

Day One started with a long winding trek to the light that is the Build 2015 keynote.

Light at the end of the tunnel. Light at the end of the tunnel.

Satya's first demo contained the Surface, a pen, a musical C# and F# joke and off course, an index out of bounds error.

You mean there's more to F# than being a hipster programming language? You mean there's more to F# than being a hipster programming language?

The Gu presented Azure as the only hyper cloud solution with more data center locations than Google and Amazon combined. Also you can leverage your existing skills, even Linux and JavaScript.

THIS IS THE BEST CLOUD! THIS IS THE BEST CLOUD!

Next was the CEO of Docker, Ben Golub, Docker for Windows is on. Like Donkey Kong. "Choose the best damn tools for the best damn application. And run it on any server". Love it!

Minecraft Docker container. Check! Thank you Mark.

Docker for Windows

Publish Docker container right from Visual Studio 2015. Check!

Attach the debugger from Visual Studio 2015 to a running Container and hitting breakpoints. Container running nix and .Net Core CLR.

Also, run the .Net Core CLR on OS X.

Mark is pushing his second favourite company. Mark is pushing his second favourite company.

Hanselman is here! Showing Android app written with Apache Cordova running on the built in Android emulator from Visual Studio. Nice.

Android simulators are more plentiful than JavaScript-frameworks. Android simulators are more plentiful than JavaScript-frameworks.

Visual Studio Code on OS X!!! Mind suffiently blown! Thanx Scott!

Written using Electron.js

OS X in a Microsoft keynote. The tables have truly turned. OS X in a Microsoft keynote. The tables have truly turned.

And on Ubuntu!

Tux watches as hell freezes over. Tux watches as hell freezes over.

SaaS - SQL as a service. SQL is not dead, it's in the cloud.

Azure Insights is looking awesome. "Cortana, should i do a 10% promotion"?

Azure enables JustGiving to create iRobot charity giving intelligence.

OS X Leopard wants its wallpaper back. OS X Leopard wants its wallpaper back.

Now comes the more boring stuff. Office with a SAP-plugin. On iPad! I take back the boring part.

The iPad even makes SAP better. The iPad even makes SAP better.

Every major modern application needs a solid extension model.

Uber extension in the iOS edition of Outlook. Uber extension in the iOS edition of Outlook.

And REST-endpoints.

If you're seeing JSON, you're doing something right. If you're seeing JSON, you're doing something right.

Memo to self: disable drug dealer notifications while presenting on stage.

Even Satya wants the iPad Air 2. Should've been gold though. Even Satya wants the iPad Air 2. Should've been gold though.

Windows 10 is a new generation of Windows. Mobility across devices. Benefit the user.

WaS: Windows as a Service. To 1 000 000 000 users.

1 Billlllllllllion! 1 Billlllllllllion!

Windows Store, please make it work this time.

These are the hopeful eyes of a dreamer. These are the hopeful eyes of a dreamer.

Universal Apps is the next big Bing, I mean thing. Great support for Web applications.

Universal platform capabilities are now available for .Net and Win32 applications. DIPS is ready for the Windows Store. Running isolated from the rest of apps.

Photoshop running as a Universal App, with some camera magic added in too. Photoshop running as a Universal App, with some camera magic added in too.

Windows Phone now comes with Android! Run your Java or C++ Android apps on Windows Phone. Is Nice!

Or your ObjectiveC iOS app! Compile and link using Visual Studio on Windows 10 :)

Please make apps for our platform. Pliz! Please make apps for our platform. Pliz!

Great syntax highlighting for ObjectiveC, highlighting all of ObjectiveC's poor syntax. Lol.

ObjectivC is not prettier in Visual Studio ObjectivC is not prettier in Visual Studio

One more thing. The Prize of the show is an HP Spectre x360.

It has 5 screens! It has 5 screens!

Joel showing of Aero Windows 10. Brings back memories.

The start menu is like a Windows Phone The start menu is like a Windows Phone

And now the Windows 10 login screen, direct with app commercials from the Windows Store.

Project Spartan is now Microsft Edge. Memo to self: never use your internal code names in public.

Looking over the edge of the world. Looking over the edge of the world.

RES (Reddit Enhancement Suite) is available for Edge already.

Windows 10 phones are omnidevices, becomming a PC when a keyboard and mouse are connected.

It's a phone. I mean it's a PC! It's a phone. I mean it's a PC!

Continuum is Handoff on acid.

People, not devices, are mobile. Bring on the Holograms!

The future is very intense. And somewhat angry. The future is very intense. And somewhat angry.

Microsoft Bob 2.0! Windows Holographic platform.

Look at the puppy! Look at the puppy!

Hololens is really cool in a professional setting.

View real physical objects in a greater than real detail.

No Phone or PC required.

Microsoft is running a Jony Ive design video, without Sir Jony. And not just on a white background.

Not pure enough! Where is the white room? Not pure enough! Where is the white room?

All Universal Windows Apps can be holograms.

You can now sumperimpose a virtual robot on a real one.

Read More

New features in FermiContainer 1.1

FermiContainer gains features, but while doing so becomes even more simple. How is this possible? Let me tell you:

Automatic resolving of constructor arguments

Through constructor injection, the dependencies known to the container are automatically resolved. No attributes or XML configuration are needed.

[Test]
public void Register_EvenMoreComplexClass_CanBeResolved() {
  m_fermiContainer.Register<IEvenMoreComplex, EvenMoreComplex>();
  m_fermiContainer.Register<ICalculator, Calculator>();
  m_fermiContainer.Register<IComplex, ComplexClass>();
  m_fermiContainer.Register<ClassWithoutInterface>();

  var complexInstance = m_fermiContainer.Resolve<IEvenMoreComplex>();

  IsInstanceOf<IEvenMoreComplex>(complexInstance);
}

public interface ICalculator {}

public class Calculator : ICalculator {}

public interface IComplex {}

public class ComplexClass : IComplex {
  public ComplexClass(ICalculator calculator) {}
}

public interface IEvenMoreComplex {}

public class EvenMoreComplex : IEvenMoreComplex {
  public EvenMoreComplex(
    IComplex complex, I
    Calculator calculator, 
    ClassWithoutInterface classWithoutInterface) {}
}

public class ClassWithoutInterface {}>

Default container instance

var instance = FermiContainer.DefaultInstance;

IsInstanceOf<IFermiContainer>(instance);
Assert.AreSame(instance, FermiContainer.DefaultInstance);

Easier to extend

The Services dictionary is now protected so FermiContainer is easily extendable.

Better performance

C# expressions makes FermiContainer very performant.

Available as source through NuGet

PM> Install-Package FermiContainer.Sources

Read More

Introducing FermiContainer - an IoC container for the rest of us

Fermicontainer icon

What the world needs most is more IoC containers in the .Net space.

So I created FermiContianer, the simples IoC container imaginable.

It supports registering implementations of interface using either a default constructor or a factory method.

IFermiContainer fermiContainer = new FermiContainer();

fermiContainer.Register<ICalculator, Calculator>();
fermiContainer.Register<ClassWithOutAnInterface>();

Resolve gives you a new instance each time.

var calculator = fermiContainer.Resolve<ICalculator>();

Assert.IsInstanceOf<Calculator>(calculator);

var calculator2 = fermiContainer.Resolve<ICalculator>();

Assert.AreNotSame(calculator, calculator2);

Singleton will return the same instance.

var calculator = fermiContainer.Singleton<ICalculator>();

var calculator2 = fermiContainer.Singleton<ICalculator>();

Assert.AreSame(calculator, calculator2);

That's it! Available through NuGet for for .Net 4.0 or later, Xamarin.iOS, Xamarin.Mac, Xamarin.Android, Windows 8, Windows Phone 8, Windows Store apps and Silverlight 5. The source lives on GitHub.

PM> Install-Package FermiContainer

If FermiContainer ever becomes too simple for your needs, I recommend LightInject.

Read More

Windows Forms + CefSharp = grey content?

I've lately been evaluating CefSharp to use as an embedded browser in an old Windows Forms project.

The examples are great and the packages from nuget are easy to use, but I ran into an annoying issue. The content of the loaded page was sometimes grey. Nothing but grey. However, when I resized the embedded browser window, the page appeared. Just as it should. What is going on here?

The browser-control was added to the Form in a normal fashion:

...
browser.Dock = DockStyle.Fill;
...
Controls.Add(browser);

The appearance of the page content after resize was a clue. Perhaps the content was loaded correctly, but the control was too small to show it? Curious that DockStyle.Fill didn't do the trick as it usually does, but worth a try:

...
browser.Dock = DockStyle.Fill;
browser.Size = Size;
...
Controls.Add(browser);

Now the browser always has the correct size and all is well, or rather, as well as can be while working with Windows Forms...

Read More

No content in Solution Explorer using Visual Studio 2013

After opening Visual Studio 2013 (VS) today, I was greeted with an empty Solution Explorer window. This was strange because I'd opened VS by double clicking my solution-file. My Team Explorer window could not help me either, it just showed:

Page '312e8a59-2712-48a1-863e-0ef4e67961fc' not found.

In my previous VS session I had both connected to my Team Foundation 2013 Server (TFS) and worked on this specific solution. What's going on here?

Solution explorer Error guid

The first law of tech support or troubleshooting is to turn the thing off and on again. VS didn't even manage to close properly and teased me with this friendly message:

No exports were found that match the constraint: ContractName Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService RequiredTypeIdentity Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService  
No exports were found that match the constraint: ContractName Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService RequiredTypeIdentity Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService  

Googling this message produced a Microsoft Connect report with the following suggestion:

This issue is because of a MEF cache corruption. Installing the feedback extension (or installing any extension) will invalidate the cache causing VS to rebuild it.

That tip actually worked! I uninstalled one of the extensions I never use, restarted VS and my solution opened as i should. I even managed to connect to TFS! I don't understand what really caused this issue, but I suspect the error messages could be more helpful if they tried...

Read More

Debugger.Launch() in Services on Windows 8

I tried debugging (sorry Uncle Bob) a regular Windows service on Windows 8.1 the other day. As so many times before, I started with adding Debugger.Launch() in the beginning of the service, compiled it under Debug, copied the DLLs and started the service.

In Windows 7, the JIT debugger selection popup would then appear, and the correct instance of Visual Studio could be selected to perform the debugging session. This time though, nothing.

As always when nothing happens in Windows, I checked the event viewer.

Debugger launch in services on Windows 8

An unhandled Microsoft .NET Framework exception occurred in WindowsService.Server.exe [6652]. Just-In-Time debugging this exception failed with the following error: The operation attempted is not supported.

Check the documentation index for 'Just-in-time debugging, errors' for more information.

So I did.

The Solution

You need to change a registry key to enable debugging of a Session 0 process (like a windows service) on Windows 8. The Visual Studio JIT Debugger has its AppIDFlags set to APPIDREGFLAGS_IUSERVER_ACTIVATE_IN_CLIENT_SESSION_ONLY (0x20) and APPIDREGFLAGS_IUSERVER_UNMODIFIED_LOGON_TOKEN (0x8), thus preventing debugging.

Change the key to 0x8 by running the following command:

reg add "HKCR\AppID{E62A7A31-6025-408E-87F6-81AEB0DC9347}" /v AppIDFlags /t REG_DWORD /d 8 /f

When your code works and you never want to debug again, restore the default value 0x28 by running:

reg add "HKCR\AppID{E62A7A31-6025-408E-87F6-81AEB0DC9347}" /v AppIDFlags /t REG_DWORD /d 40 /f

Read More

Windows Installer error 1603

While trying to install the drivers for the new Microsoft Sculpt Ergonomic Keyboard, the installer presented the following informative message:

Error 1603

Microsoft's knowledge base article, "You receive an error 1603: A fatal error occurred during installation error message when you try to install a Windows Installer package", suggested:

The SYSTEM account does not have Full Control permissions on the folder that you are trying to install the Windows Installer package to.

As all permission were in order, I remembered the old adage: When in doubt, shutdown your antivirus software. So I did, tried to reinstall and error 1603 disappeared.

Read More