VS 2015 SSIS 脚本任务无法调试 [英] VS 2015 SSIS Script Tasks cannot be debugged
问题描述
我花了好几个小时才弄明白为什么我的 ssis 脚本组件在遇到断点时没有进入调试器.我在网上搜索并关闭了 64 位设置(项目 -> 属性 -> 调试),但它没有帮助我.
Just spent hours pulling my hair trying to work out why my ssis Script Component was not breaking into debugger on hitting a breakpoint. I searched the web and fund 64 bit setting (Project -> Properies -> Debugging) to be turned off but it didn't help me.
事实证明,如果我在代码中使用字符串插值 ( $"{someVar}" ),则调试器不会启动.一旦我用旧的 string.Format("{0}...", param1, ...) 方法替换了它,我的断点就会被击中,我可以单步执行代码.
It turns out that if I use string interpolation ( $"{someVar}" ) in my code then debugger does not start. Once I replaced it with the old string.Format("{0}...", param1, ...) method my breakpoints got hit and I could step through the code.
无论哪种方式,代码都可以工作,只是调试器受到新语法的影响.
The code works either way and it is just the debugger that is affected by the newer syntax.
我希望这对某人有所帮助.
I hope this helps someone.
推荐答案
确实,将 C# 脚本任务限制为 C# 4.0 的语言功能使调试器恢复生机.就我而言,在 SQL Server/SSIS 2016 上使用 Visual Studio 2015 (VSTA) 添加单个空合并运算符会导致调试器问题.
Indeed, limiting C# Script Tasks to language features of C# 4.0 brings the Debugger back to life. In my case, adding a single null-coalescing operator caused the debugger issue using Visual Studio 2015 (VSTA) on SQL Server/SSIS 2016.
要将脚本限制为 C# 4.0,我们可以在任务的构建设置中强制执行特定的语言级别:
To restrict the Script to C# 4.0 we can enforce a specific Language Level in the Build settings of the Task:
- 打开有问题的脚本任务,点击编辑脚本..."按钮打开 Visual Studio (VSTA).
- 在解决方案资源管理器中右键单击项目节点并选择属性
- 在项目"窗口中,转到构建标签,向下滚动并点击高级..按钮.
- 在高级构建设置窗口中,将语言版本从默认"更改为C# 4.0".
- 清理/重建脚本任务,修复编译错误.
- 最后,退出VSTA,重建项目
- Open the Script Task in question, click the "Edit Script..." button to open Visual Studio (VSTA).
- In the Solution Explorer right-click the Project node and select Properties
- In the Project window, go the Build tab, scroll down and click the Advanced.. button.
- In the Advanced Build Settings window change the Langauge Version from "default" to "C# 4.0".
- Clean/Rebuild the Script Task, fix compilation errors.
- Finally, exit VSTA, rebuild the project
然后您应该能够再次调试 C# 脚本任务.
and then you should be able to debug the C# Script Task again.
这篇关于VS 2015 SSIS 脚本任务无法调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!