public static string GetAssemblyLocation([NotNull] string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            var result = WinApi.CreateAssemblyCache(out var assemblyCache, 0);

            if (result < WinApi.HResult.SOk)
            {
                throw new CreateAssemblyCacheException((int)result);
            }

            var info = new WinApi.AssemblyInfo
            {
                cchBuf = BufferSize,
                currentAssemblyPath = new string(InitialChar, BufferSize)
            };


            result = assemblyCache.QueryAssemblyInfo(WinApi.QueryAssemblyInfoFlags.Validate, name, ref info);
            if (result < WinApi.HResult.SOk)
            {
                throw new QueryAssemblyInfoException(name, (int)result);
            }

            return(info.currentAssemblyPath);
        }
        /// <summary>
        /// Tries the get assembly path.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">name</exception>
        public static bool TryGetAssemblyLocation([NotNull] string name, out string path)
        {
            //Siemens.Sinumerik.Operate.Services, Version=4.8.5.4, Culture=, PublicKeyToken=bdd90fa02fd1c4ee, processorArchitecture=x86
            //Siemens.Sinumerik.Operate.Services, Version=4.8.5.4, Culture=neutral, PublicKeyToken=bdd90fa02fd1c4ee, processorArchitecture=x86
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            try
            {
                var finalName = name;
                var info      = new WinApi.AssemblyInfo {
                    cchBuf = BufferSize
                };
                info.currentAssemblyPath = new string(InitialChar, info.cchBuf);

                var result = WinApi.CreateAssemblyCache(out var assemblyCache, 0);
                if (result < WinApi.HResult.SOk)
                {
                    path = null;
                    return(false);
                }

                result = assemblyCache.QueryAssemblyInfo(WinApi.QueryAssemblyInfoFlags.None, finalName, ref info);
                if (result != WinApi.HResult.SOk)
                {
                    path = null;
                    return(false);
                }
                path = info.currentAssemblyPath;
                return(true);
            }
            catch
            {
                path = null;
                return(false);
            }
        }