0

Expected behavior

In VS Code (or other IDE);

  • add break point to first line of [app root]/ config/application.rb; require_relative 'boot'
  • start debug.
  • debugger should stop at breakpoint

Actual behavior

  • debugger continues without stopping
  • NB: Any breakpoint further into execution of the Rails app fails to halt execution.

Notes;

Looking at https://github.com/Shopify/bootsnap/issues/93, I believe this problem occurs due a combination of the following; - new Ruby 2.5 feature "Remove trace instructions" (https://bugs.ruby-lang.org/issues/14104) - Rails 5.2 inclusion of bootsnap gem

NB: The same problem is occurring in other IDE's; - Jetbrains; https://youtrack.jetbrains.com/issue/RUBY-20684 - RubyMine; https://github.com/ruby-debug/ruby-debug-ide/issues/139

My environment

  • vscode-ruby version: 0.18.0
  • Ruby version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
  • Rails version: 5.2.0
  • ruby-debug-ide version: 0.6.1
  • debase version: 0.2.2
  • VS Code version: 1.22.2 (1.22.2)
  • Operating System: macOS 10.13.4 (17E199)
  • Hardware (optional): MacBook Pro (13-inch, Mid 2012) & MacBook (13-inch, Mid 2010)
0

Work around

  • Edit [app root]/ config/boot.rb
  • Replace line;

    require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

  • With;

    unless ( (('2.5.0'..'2.5.1').include? RUBY_VERSION) && defined?(Debugger) ) require 'bootsnap/setup' # Speed up boot time by caching expensive operations. end

NB:

It would appear the underlying Ruby issue will be fixed in 2.5.2 (ruby/ruby@b85b10c).

Given the problem only existed on Ruby versions 2.5.0 through 2.5.1, the above workaround should work for all the affected versions and leave all other versions alone. (i.e. It should work appropriately in all configurations)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.