// get uploaded script (Python or Ruby), compile it, and then place DLL in staging area for error checking
        // ValidateViaDlr is invoked in a separate AppDomain to run the bot and so detect (some) syntax errors
        private static String ValidateScript(BotCompiler.Language lang, HttpPostedFileBase file, ref List<BotValidationError> errList)
        {
            var dllPath = String.Empty;
            try
            {
                // save uploaded file in temp area
                String tmpFile = Path.Combine(Path.GetTempPath(), Path.GetFileName(file.FileName));
                file.SaveAs(tmpFile);

                // compile file into assembly
                dllPath = BotCompiler.Compile(lang, tmpFile, ref errList);

                // validate dynamic language script
                using (var staging = new StagingArea())
                {
                    var reflectionErrors = AppDomainHelper.InSeparateAppDomain<String, IEnumerable<BotValidationError>>(staging.Root, dllPath, ValidateViaDlr);
                    foreach (var err in reflectionErrors)
                        errList.Add(err);
                }
            }
            catch (Exception e)
            {
                errList.Add(new BotValidationError("ValidateScript: " + e.Message));
                dllPath = String.Empty;
            }

            return dllPath;
        }
        // grab uploaded DLL (C#, VB, F#) and place it in staging area to validate that DLL implements required interfaces
        // ValidateDotNetInterfaces is invoked in a separate AppDomain to make the determination
        private static String ValidateAssembly(HttpPostedFileBase file, ref List<BotValidationError> errList)
        {
            var dllPath = String.Empty;
            try
            {
                // save uploaded file in temp area
                dllPath = Path.Combine(Path.GetTempPath(), Path.GetFileName(file.FileName));
                file.SaveAs(dllPath);

                // validate implementation of the required interfaces
                using (var staging = new StagingArea())
                {
                    var reflectionErrors = AppDomainHelper.InSeparateAppDomain<String, IEnumerable<BotValidationError>>(staging.Root, dllPath, ValidateDotNetInterfaces);
                    foreach (var err in reflectionErrors)
                        errList.Add(err);
                }
            }
            catch (Exception e)
            {
                errList.Add(new BotValidationError("ValidateDll: " + e.Message));
                dllPath = String.Empty;
            }

            // return assembly path (or empty if there's a problem)
            return dllPath;
        }