无法从VS2010进行调试

用户3456466

我正在尝试编译下面的代码,但现在无法调试。任何想法 ?

using System;
using System.Collections.Generic;
using Microsoft.AnalysisServices;
using System.Runtime.Serialization;

namespace SqlBi.Tools {
    /// <summary>
    /// MdxScriptUpdater handles the manage of custom 
    /// MDX statements into an existing cube
    /// Use in this way:
    /// 1 - Create a MdxScriptUpdater instance specifying a server name
    /// 2 - Add MDX statements you want to put into the cube adding strings to MdxCommands collection
    /// 3 - Call Update method passing the name of database and cube - you have to use object IDs instead of displayed names!
    /// </summary>
    public class MdxScriptUpdater : IDisposable {
        /// <summary>
        /// Type of update
        /// </summary>
        public enum UpdateType {
            /// <summary>
            /// Delete existing commands and insert the new ones
            /// </summary>
            DeleteAndInsert, 
            /// <summary>
            /// Only delete existing commands
            /// </summary>
            DeleteOnly, 
            /// <summary>
            /// Only insert new commands (be careful, you can create duplicates!)
            /// </summary>
            InsertOnly
        };

        private string _marker = "/* AUTO-GENERATED */";
        private Server _serverConnection = null;
        private bool _ownedServer = false;
        private List<string> _mdxCommands;

        /// <summary>
        /// Marker is a comment that is put in front of the MDX statement to recognize managed MDX statements
        /// </summary>
        public string Marker {
            get { return this._marker; }
            set { this._marker = value; }
        }

        /// <summary>
        /// This is the connection to the server. 
        /// It is auto generated by the constructor but you can use your own connection, if you want
        /// </summary>
        public Server ServerConnection {
            get { return this._serverConnection; }
            set {
                if (this._serverConnection != null && _ownedServer) {
                    try {
                        this.Dispose();
                    }
                    finally {
                        _ownedServer = false;
                    }
                }
                this.ServerConnection = value;
                _ownedServer = true;
            }
        }

        /// <summary>
        /// List of Mdx statements to add/update into the cube
        /// Populate the list before calling the Update(...) method
        /// </summary>
        public List<string> MdxCommands {
            get { return this._mdxCommands; }
            set { this._mdxCommands = value; }
        }

        /// <summary>
        /// Default constructor - connection is not defined
        /// </summary>
        public MdxScriptUpdater() {
            this._mdxCommands = new List<string>();
        }

        /// <summary>
        /// Constructor that connects to the specified server
        /// </summary>
        /// <param name="serverName">Name of the Analsys Services server instance (SERVERNAME or SERVERNAME\INSTANCE)</param>
        public MdxScriptUpdater( string serverName ) : this() {
            this._serverConnection = new Server();
            this.ServerConnection.Connect( serverName );
        }

        /// <summary>
        /// Apply updates to the specified cube
        /// Deletes existing managed Mdx commands and insert the ones in MdxCommands string collection
        /// </summary>
        /// <param name="databaseName">Name (ID) of the Database</param>
        /// <param name="cubeName">Name (ID) of the Cube</param>
        public void Update( string databaseName, string cubeName ) {
            Update( databaseName, cubeName, UpdateType.DeleteAndInsert );
        }

        /// <summary>
        /// Apply updates to the specified cube
        /// </summary>
        /// <param name="databaseName">Name (ID) of the Database</param>
        /// <param name="cubeName">Name (ID) of the Cube</param>
        /// <param name="updateType">Type of update</param>
        public void Update( string databaseName, string cubeName, UpdateType updateType ) {
            Database db = ServerConnection.Databases[databaseName];
            Cube cube = db.Cubes[cubeName];
            Update( cube, updateType );
        }

        /// <summary>
        /// Apply updates to the specified cube
        /// </summary>
        /// <param name="cube">Cube object</param>
        public void Update( Cube cube ) {
            Update( cube, UpdateType.DeleteAndInsert );
        }

        /// <summary>
        /// Apply updates to the specified cube
        /// </summary>
        /// <param name="cube">Cube object</param>
        /// <param name="updateType">Type of update</param>
        public void Update( Cube cube, UpdateType updateType ) {
            // Look for the default MDX Script object
            foreach( MdxScript script in cube.MdxScripts) {
                if (script.DefaultScript) {
                    Update( script, updateType );
                    cube.Update();
                    return;
                }
            }
            throw new MdxScriptUpdaterException( "Default script not found" );
        }

        /// <summary>
        /// Update an MdxScript
        /// Deletes existing managed Mdx commands and insert the ones in MdxCommands string collection
        /// </summary>
        /// <param name="script">MdxScript to update</param>
        /// <param name="updateType">Type of update</param>
        public void Update( MdxScript script, UpdateType updateType ) {
            if (updateType == UpdateType.DeleteAndInsert || updateType == UpdateType.DeleteOnly) {
                DeleteMarkedCommands( script );
            }
            if (updateType == UpdateType.DeleteAndInsert || updateType == UpdateType.InsertOnly) {
                InsertMarkedCommands( script );
            }
            script.Update();
        }

        /// <summary>
        /// Deletes existing managed Mdx commands using default Marker comment string
        /// </summary>
        /// <param name="script">MdxScript to update</param>
        public void DeleteMarkedCommands( MdxScript script ) {
            DeleteMarkedCommands( script, Marker );
        }

        /// <summary>
        /// Deletes existing managed Mdx commands using a custom Marker comment string
        /// </summary>
        /// <param name="script">MdxScript to update</param>
        /// <param name="marker">Custom marker comment string</param>
        public static void DeleteMarkedCommands( MdxScript script, string marker ) {
            for( int i = script.Commands.Count - 1; i >= 0; i-- ) {
                if (script.Commands[i].Text.Contains( marker )) {
                    script.Commands.RemoveAt( i );
                }
            }
        }

        /// <summary>
        /// Insert managed commands of MdxCommands string collection
        /// </summary>
        /// <param name="script">MdxScript to update</param>
        public void InsertMarkedCommands( MdxScript script ) {
            InsertMarkedCommands( script, this.MdxCommands, Marker );
        }

        /// <summary>
        /// Insert managed commands of a custom string collection
        /// </summary>
        /// <param name="script">MdxScript to update</param>
        /// <param name="commands">Custom string collection of Mdx commands to insert</param>
        public void InsertMarkedCommands( MdxScript script, IEnumerable<string> commands ) {
            InsertMarkedCommands( script, commands, Marker );
        }

        /// <summary>
        /// Insert managed commands of MdxCommands string collection using a custom Marker comment string
        /// </summary>
        /// <param name="script">MdxScript to update</param>
        /// <param name="marker">Custom marker comment string</param>
        public void InsertMarkedCommands( MdxScript script, string marker ) {
            InsertMarkedCommands( script, this.MdxCommands, marker );
        }

        /// <summary>
        /// Insert managed commands of a string collection using a custom Marker comment string
        /// </summary>
        /// <param name="script">MdxScript to update</param>
        /// <param name="commands">Custom string collection of Mdx commands to insert</param>
        /// <param name="marker">Custom marker comment string</param>
        public static void InsertMarkedCommands( MdxScript script, IEnumerable<string> commands, string marker ) {
            foreach( string mdxCommand in commands ) {
                Command cmd = new Command();
                cmd.Text = marker + mdxCommand;
                script.Commands.Add( cmd );
            }
        }

        #region IDisposable Members

        public void Dispose() {
            if (this.ServerConnection != null && _ownedServer) {
                this.ServerConnection.Disconnect();
                this.ServerConnection.Dispose();
            }
            // Write directly to private member, skip the property setter
            this._serverConnection = null;
        }

        #endregion
    }

    public class MdxScriptUpdaterException : Exception {
        public MdxScriptUpdaterException() : base() {}
        public MdxScriptUpdaterException( string message ) : base( message ) {}
        public MdxScriptUpdaterException( string message, Exception innerException ) : base( message, innerException ) {}
        protected MdxScriptUpdaterException( SerializationInfo info, StreamingContext context ) : base( info, context ) {}
    }
}

Program.cs

using System;
using System.Collections.Generic;
using System.Text;
using SqlBi.Tools;
using System.IO;

namespace SqlBi.Tools {
    class DemoMdxScriptUpdater {
        static void Main( string[] args ) {
            Demo();
        }
        static void Demo() {
            MdxScriptUpdater updater = new MdxScriptUpdater("test");

            string ScriptMdx = File.ReadAllText(@"D:\\ScriptMdx.txt");
            //Console.WriteLine("--- Contents of file.txt: ---");
            //Console.WriteLine(ScriptMdx);
            updater.MdxCommands.Add(ScriptMdx);

            updater.Update("BI", "BI1"); 

        }
    }
}

'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_64 \ mscorlib \ 2.0.0.0__b77a5c561934e089 \ mscorlib.dll',已跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ Microsoft.VisualStudio.HostingProcess.Utilities \ 10.0.0.0__b03f5f7f11d50a3a \ Microsoft.VisualStudio.HostingProcess.Utilities.dll' ,跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ System.Windows.Forms \ 2.0.0.0__b77a5c561934e089 \ System.Windows.Forms.dll',已跳过加载符号。模块已优化,调试器选项“ “仅我的代码”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ System \ 2.0.0.0__b77a5c561934e089 \ System.dll',已跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(托管(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ System.Drawing \ 2.0.0.0__b03f5f7f11d50a3a \ System.Drawing.dll',已跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ Microsoft.VisualStudio.HostingProcess.Utilities.Sync \ 10.0.0.0__b03f5f7f11d50a3a \ Microsoft.VisualStudio.HostingProcess.Utilities。 Sync.dll',跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ Microsoft.VisualStudio.Debugger.Runtime \ 10.0.0.0__b03f5f7f11d50a3a \ Microsoft.VisualStudio.Debugger.Runtime.dll' ,跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Users \ Desktop \ HaysDW \ 05.Tools \ MdxScriptUpdater \ bin \ Debug \ MdxScriptUpdater.vshost.exe',已跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ Microsoft.AnalysisServices \ 11.0.0.0__89845dcd8080cc91 \ Microsoft.AnalysisServices。dll”,跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ Microsoft.AnalysisServices.AdomdClient \ 11.0.0.0__89845dcd8080cc91 \ Microsoft.AnalysisServices.AdomdClient.dll',已跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_64 \ System.Data \ 2.0.0.0__b77a5c561934e089 \ System.Data.dll',已跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ System.Xml \ 2.0.0.0__b77a5c561934e089 \ System.Xml.dll' ,跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。线程“ vshost.NotifyLoad”(0x5840)已退出,代码为0(0x0)。线程“ vshost.LoadReference”(0x7b2c)已退出,代码为0(0x0)。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Users \ Desktop \ HaysDW \ 05.Tools \ MdxScriptUpdater \ bin \ Debug \ MdxScriptUpdater.exe',已加载符号。'MdxScriptUpdater.vshost.exe'(受管理(v2.0.50727)):已加载'C:\ Windows \ assembly \ GAC_MSIL \ System.Configuration \ 2.0.0.0__b03f5f7f11d50a3a \ System.Configuration.dll',已跳过加载符号。模块已优化,调试器选项“ Just My Code”已启用。线程“ vshost.RunParkingWindow”(0x6e88)已退出,代码为0(0x0)。线程'' (0x4a9c)已退出,代码为0(0x0)。程序“ [4784] MdxScriptUpdater.vshost.exe:托管(v2.0.50727)”已退出,代码为0(0x0)。程序“ [4784] MdxScriptUpdater.vshost.exe:程序跟踪”已退出,代码为0(0x0)。

亚历克斯

与您在“工具”->“选项”->“调试器”中以某种方式禁用了“仅我的代码”复选框相比,我将采取一个平底船

Visual Studio调试选项

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

FFmpeg和VS2010(调试与发布)

来自分类Dev

调试断言失败VS2010

来自分类Dev

在VS2010中进行调试时,为什么控制键会“卡住”?

来自分类Dev

VS2010在“停止调试”后停止运行(Web API)

来自分类Dev

在VS2010中调试cpp错误值

来自分类Dev

在VS2010中调试cpp错误值

来自分类Dev

VS2010调试器无法在监视窗口中正确跟踪变量,VS2013仍然存在此错误吗?

来自分类Dev

VS2010调试器无法在监视窗口中正确跟踪变量,VS2013仍然存在此错误吗?

来自分类Dev

VS2010中无法解析的外部符号

来自分类Dev

如何重置VisualStudio(VS2010,VS2012)调试器缓存?

来自分类Dev

在VS2010调试器中可视化OpenCV映像

来自分类Dev

C ++ VS2010调试器在超出循环范围的循环变量上表现异常

来自分类Dev

在发布模式下,库大小较大,而在VS2010中为调试模式

来自分类Dev

无法在TypeScript中进行调试-VS代码

来自分类Dev

从VS2010升级到VS2013现在我无法发布

来自分类Dev

无法在vs2012中打开vs2010 csproj文件

来自分类Dev

FFmpeg and VS2010 (Debug vs Release)

来自分类Dev

附加到VS2010的进程中以进行CPU性能分析

来自分类Dev

无法在VS2010中添加新团队项目。错误TF249063

来自分类Dev

npm无法说“找不到VS2010的构建工具”

来自分类Dev

无法在Win7 / VS2010上构建WebKit-r161259

来自分类Dev

VS2010源文件“ Project \ SharedAssemblyInfo.cs”无法打开(未指定错误)

来自分类Dev

“未找到类型'DatePicker'”,似乎无法解决VS2010中的此错误

来自分类Dev

VS2010 IDE的Signalr安装问题

来自分类Dev

VS2010和Windows 8.1

来自分类Dev

将VS2010与Assimp链接

来自分类Dev

使用MAP文件VS2010 MFC

来自分类Dev

使用VS2010登录的SQL SERVER

来自分类Dev

VS2010 ASP.NET配置

Related 相关文章

热门标签

归档