Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

HoloToolkit - How can I create PERSISTENT session from console/web based client?

I'm using HoloToolkit library in C# console (and web) applications, only to create a session (to which other HoloLens based clients will connect later). But it is only creating ADHOC session despite passing SessionType as PERSISTENT.

Following is the Main() function code:

XToolsApp xToolsApp = new XToolsApp();
Timer timer = new Timer(60);
timer.Elapsed += (source, e) => { xToolsApp.Update(); };
NetworkConnectionData networkConnectionData = new NetworkConnectionData(xToolsApp)
UserName = "TestUser",
ServerAddress = "localhost:20602",
ViewerAddress = "localhost:20603"
xToolsApp.SessionManagerListener.SessionAdded += (session) =>
if (session.GetName().GetString().Equals("Default", StringComparison.OrdinalIgnoreCase))
xToolsApp.CreateSession("TestSession", SessionType.PERSISTENT);

In above Main() function code, the statement "xToolsApp.CreateSession("TestSession", SessionType.PERSISTENT)" calls the following function:

public bool CreateSession(string sessionName, SessionType sessionType)
XString nameXString = new XString(sessionName);
LogWriteLine("Creating Session " + sessionName);
if (!this.SessionManager.CreateSession(nameXString, sessionType))
LogWriteLine("Failed to request a new session!");
return false;
return true;

Then, finally, in above function, the statement "this.SessionManager.CreateSession(nameXString, sessionType)" calls following method which was auto generated by HoloToolkit.Sharing library and I think this code calls native code (inside SharingClient.Dll file which is placed in bin folder):

public virtual bool CreateSession(XString sessionName, SessionType type)
bool ret = SharingClientPINVOKE.SessionManager_CreateSession__SWIG_1(swigCPtr, XString.getCPtr(sessionName), (int)type);
return ret;

So, you see that I'm passing Session type as PERSISTENT but I still always get only ADHOC session created, which closes itself as soon as my client leaves that session (as no other user is present in that session). What should I do to get PERSISTENT session created from my client code?

P.S. - I created same question in forum yesterday but it is not appearing (may be due to pending approval?).

Sign In or Register to comment.