public override Task <RFmxSession> Initialize(RFmxResource request, ServerCallContext context) { var instr = RFmxInstrMX.GetSession(request.Name, request.OptionString, out bool isNewSession); var handle = instr.GetInstrumentHandle().DangerousGetHandle(); if (isNewSession) { sessionMap.Add(handle, instr); } return(Task.FromResult(new RFmxSession() { Handle = handle.ToInt64() })); }