Cannot use LearningTransport in Service Fabric without specifying the StorageDirectory

I was getting an exception stating that the .learningtransport directory did not exist. The documentation is not 100% clear, but I figured that I had to create it manually. But this didn’t help either. Looking at the sources, I saw that the implementation assumes that the code runs in some folder under the solution file.
This is not always the case when debugging. Someone could specify a different output directory, but specifically with ServiceFabric, SF runs the solution in the local cluster which is not under the solution folder.

It can be workarounded by specifying the transport directory, but it’s not obvious and the developer experience is not great. This could be improved (documented and maybe even explained in the exception text) or find a different solution.

Hi Francesc,

You are right that the code assumes it runs in a specific folder under the solution file. When we created the learning transport the primary purpose of the transport was to enable F5 experience for samples and quick demos. Service Fabric SDK under the hood does a lot of heavy-lifting and “magic” to allow a decent debugging experience. The assumptions that the learning transport makes break apart under Service Fabric. For more exotic scenarios like this, we allow specifying a common location that can be referenced. In fact, I’d argue with Service Fabric, there is no way around that because you wouldn’t want that folder to be node specific. It has to be a shared location that can be accessed from all the nodes. Even for demos, it could be possible that the executables get moved by the cluster resource manager and then you’d end up with weird runtime scenarios like messages not being picked up.

That being said we appreciate your input and feedback. Could you clarify which exception you saw? One of the exception that we raise is

Which hints that the path needs to be set manually. Or did you receive another exception?


Hi Daniel,
you are right that when thinking about it, it makes sense that the directory has to be explicitly specified with SF, but when you try so many new things, you don’t really stop to think of the logic behind every thing.

The exception text that you showed makes perfect sense and it’s exactly what I proposed in my initial comment. I believe though that this must be the lastest code, because I’m quite sure that the text I saw was only "“Couldn’t find the solution directory for the learning transport.”, but I’m not running the prerelease packages.