Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. 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.