What do you do when you have problems with assembly binding? Exceptions don’t tell very much (failed to load for some reason is all you get). You call Fuslogvw.exe to the rescue of course.
But what do you do when Fuslogvw.exe doesn’t work? You delete IE’s temporary internet files. Of course.
You might wonder what do IE’s temporary internet files have to do with fuslogvw? Here is straight from the documentation:
The Fuslogvw.exe (Assembly Binding Log Viewer) uses the Internet Explorer (IE) cache to store its binding log.
And here is the kicker
Due to occasional corruption in the IE cache, the Fuslogvw.exe (Assembly Binding Log Viewer)can sometimes stop showing new binding logs in the viewing window. As a result of this corruption, the .NET binding infrastructure (fusion) cannot write to or read from the binding log. (This issue is not encountered if you use a custom log path.) To fix the corruption and allow fusion to show binding logs again, clear the IE cache by deleting temporary internet files from within the IE Internet Options dialog.
I won’t even start how stupid the decision to use anything from IE for such a core functionality is. Besides fuslogvw will silently do nothing in case of temporary internet files corruption – instead of notifying user of a problem. Excellent and very friendly behaviour.
Anyway, clear temporary files and run fuslogvw under Administration privileges and it should work. If it still doesn’t then block a few people on Twitter, check privacy settings on Facebook and uninstall Chrome. It can’t fail!
Here is an useful CodeRush editor template if you work with Mono For Android.
I use string fv as trigger. That makes binding variables/fields to Views a bit faster and with less typing.
Example, I’d type
someView = fv
then I’d press SPACE and I’d get an extended template
someView = FindViewById<|>(Resource.Id.|);|
Then I have to type just TextView, ENTER, someView, ENTER, ENTER and I’d get
someView = FindViewById<TextView>(Resource.Id.someView);| <- this is cursor
So instead of typing the whole enchillada I had to type only the letters in yellow.
someView = fvSPACEFindViewById<TextView>(Resource.Id.someView);
With Android these statements are quite common and thus the fv template spares me a lot of typing.
But hey it can get better. If stick to a naming convetion that variable name is the same as Id name + View suffix I can enhance the template, I will name it fvx.
«FieldStart(Name)»«Caret»«Link(viewName)»«BlockAnchor»«FieldEnd»View = FindViewById<«FieldStart»«FieldEnd»>(Resource.Id.«FieldStart»«Link(viewName)»«FieldEnd»);«Target()»
Note the «Link» directive that copies the typed text. And the typing result is
fvxSPACEsomeView = FindViewById<TextView>(Resource.Id.some);
Even better now, eh. The only further improvement is to deduce the variable type and type in TextView automatically. I have to investigate this option to refine the template even further.
You can use the two templates by simply creating them in CodeRush (DevExpress/Options/Editor/Selections/Templates) or you can import them (see attached file) into templates – right click in templates list and select Import Templates…
CSharp_Righthand_MonoForAndroid.xml (10.42 kb)
When writing a logging part of an application (Mono For Android/Visual Studio) I got some, seemingly, weird Android behaviour. Since my application transmits large strings over the net I wanted to have a history of these so I can check them out. I could do it with a simple string visualizer but the thing is that Mono For Android isn’t supporting any visualizer in Visual Studio at all – they are just not there. So I’ve decided to write those strings to a SD card in a folder accessible to Windows Explorer. Which is a better option anyway, as I could manipulate those later.
Here is the (simplified) code I use to write these to SD card
string path = Path.Combine(Context.GetExternalFilesDir(null), "file.txt");
File.WriteAllText(path, "large text here");
And I get a nice file in /Android/data/[package]/files. That’s all fine. However, Windows Explorer is unaware of newly created file at all. The file is there it just doesn’t see it. Looks like the problem is that Android (tested on two devices) doesn’t notify the outside world about the file system changes. Instead one has to do it manually. But how? AFAIK it can’t be done from within Windows Explorer.
After some googling I’ve found this stackoverflow thread. I’ve ported the MediaScannerConnection solution to C#.
public class SingleMediaScanner : Java.Lang.Object, MediaScannerConnection.IMediaScannerConnectionClient
private MediaScannerConnection connection;
private string file;
public SingleMediaScanner(Context context, string file)
connection = new MediaScannerConnection(context, this);
this.file = file;
public void Connect()
public void OnMediaScannerConnected()
public void OnScanCompleted(string path, Android.Net.Uri uri)
protected override void Dispose(bool disposing)
public static void NotifyFile(Context context, string file)
SingleMediaScanner scanner = new SingleMediaScanner(context, file);
One would call SingleMediaScanner.NotifyFile(Context, “FILEPATH”) to let the outside world of the changes to the file.
Not sure whether this is the best of even correct solution but it gets the job done.
Attached are the demo, the slides and enhanced Syntax Tree visualizer that I was showing at my NT Konferenca 2012 Project Roslyn talk on Thursday.
Hope you've enjoyed the talk. Now, start producing those Roslyn extensions!
Roslyn project.ppt (326.50 kb)
IoChelper.zip (29.38 kb)
SyntaxDebuggerVisualizer.7z (46.30 kb)
There is no two dimensional scroll view for Android out of the box – the one that lets user scroll in both horizonal and vertical direction. There are either horizontal (HorizontalScrollView) or vertical (ScrollView) but not both. After some Googling around I’ve found that devs were mosty experimenting with combining HorizontalScrollView within ScrollView. This approach didn’t work for me and even if it did it has some drawbacks (such as scrolling is rectriected by one of the two directions at the same time).
At this point I was considering creating my own proper ScrollView from scratch but luckily I’ve stumbled across an implementation of the same idea by Matt Clark. The only problem was that I am on Mono For Android and Matt’s implementation is in pure java. Plus I didn’t have a clue whether his solution actually worked. Nevertheless I did convert his java code to C#/Mono For Android and voila, it worked almost immediately (after an hour or so of manual conversion – damn those java’s getters and setters instead of properties).
Attached are the C# sources in case anybody else needs it.
TwoDScrollView.cs (50.08 kb)
I’ve created a simple ASP MVC 4/jQuery Mobile UI web site that helps you with NT Konferenca 2012 lectures schedule if you have a mobile device (now, who doesn’t?). Note that it isn’t a well thought, thoroughly and carefully crafted site. Instead it is a quick and simple one, actually it took me an hour (thanks to wonderful tools – VS2010, NuGet and technologies - .net 4.0, OData, WCF Data Service, jQuery Mobile UI, ASP MVC 4 and so forth).
Feel free to browse the lectures schedule through ntk.rthand.com. I might add additional features in next days – feedback me if you’d like to see a feature.
New version of my Go To Implementator (1.0.8) is now built against DXCore/CodeRush 11.2.11.
I’ve updated my tools for managing IRST and dedicated page as well. Command line utility now displays arrays, volumes, disks, RAID support and ports.
It is also in line with the latest IRST 10.8.0.1003 drivers .
Noteworthy change is that the utilities require .net 4.0 – see the dedicated page for installation instructions and other info.
Expect much more in the future.
Here is a dedicated page to the tools.
While SignalR is a great library for push notifications it has one “flaw”. There is no included Android client implementation currently, and by Android I mean Mono For Android. Luckily SignalR is an open source project and I decided to see how hard is to make it Mono For Android compatible. It turns out that it is pretty simple.
Here is the recipe (tested on Mono For Android 4.0.x):
- SignalR depends on Newtonsoft.Json library (free, open source) developed by James Newton-King. Again, there is no Android port included with the original library but there is a port that works fine on Mono For Android. Get it here.
- Get SignalR client sources. Create new Mono For Android class library and import all (WindowsPhone version of the project) files. Add WINDOWS_PHONE conditional compilation symbol to Project Properties/Build. Then reference the Newtonsoft.Json libary.
- Mono For Android is currently missing TaskExtensions class required for unwrapping tasks. Get the sources for this class here. I assume it will appear in Mono For Android sooner or later. Add this class to the library and add proper using statements if/where necessary.
That’s it. You are now ready to receive SignalR push notifications.
Here is how you create a PersistentConnection (server part), and here is client code (that runs fine on Mono For Android).
Download the libraries and sources below
MonoForAndroid.SignalR.Client.zip (1.40 mb)
Here is the list of what’s have been added/changed in 1.0.6.:
- better handling of a single DataTable - now, when table is part of a dataset, it loads entire dataset and jumps to the selected table. Note that when committing changes in this scenario, only changes in selected DataTable will be committed.
- minor bug fixes
Go, grab v1.0.6 from dedicated page and visit forums as well.