Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ad-inserter domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-includes/functions.php on line 6131

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rehub-framework domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-includes/functions.php on line 6131

Deprecated: Creation of dynamic property ElementorPro\Plugin::$updater is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/elementor-pro/plugin.php on line 488

Deprecated: version_compare(): Passing null to parameter #2 ($version2) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/elementor/core/experiments/manager.php on line 129

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: Creation of dynamic property WU_Gateway_Manual::$site is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway.php on line 111

Deprecated: Creation of dynamic property WU_Gateway_Manual::$subscription is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway.php on line 112

Deprecated: Creation of dynamic property WU_Gateway_Paypal::$site is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway.php on line 111

Deprecated: Creation of dynamic property WU_Gateway_Paypal::$subscription is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway.php on line 112

Deprecated: Creation of dynamic property WU_Gateway_Paypal::$config is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway-paypal.php on line 132

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/wu-functions.php on line 336

Deprecated: Creation of dynamic property WU_Gateway_Paypal::$desc is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway-paypal.php on line 140

Deprecated: Creation of dynamic property WU_Gateway_Paypal::$use_button is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway-paypal.php on line 166

Deprecated: Creation of dynamic property WU_Gateway_Stripe::$site is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway.php on line 111

Deprecated: Creation of dynamic property WU_Gateway_Stripe::$subscription is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/class-wu-gateway.php on line 112

Deprecated: Return type of WU_Stripe\Util\CaseInsensitiveArray::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/Util/CaseInsensitiveArray.php on line 36

Deprecated: Return type of WU_Stripe\Util\CaseInsensitiveArray::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/Util/CaseInsensitiveArray.php on line 48

Deprecated: Return type of WU_Stripe\Util\CaseInsensitiveArray::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/Util/CaseInsensitiveArray.php on line 26

Deprecated: Return type of WU_Stripe\Util\CaseInsensitiveArray::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/Util/CaseInsensitiveArray.php on line 42

Deprecated: Return type of WU_Stripe\Util\Set::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/Util/Set.php on line 40

Deprecated: Return type of WU_Stripe\StripeObject::offsetExists($k) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/StripeObject.php on line 186

Deprecated: Return type of WU_Stripe\StripeObject::offsetGet($k) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/StripeObject.php on line 196

Deprecated: Return type of WU_Stripe\StripeObject::offsetSet($k, $v) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/StripeObject.php on line 181

Deprecated: Return type of WU_Stripe\StripeObject::offsetUnset($k) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/StripeObject.php on line 191

Deprecated: Return type of WU_Stripe\StripeObject::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/StripeObject.php on line 202

Deprecated: Return type of WU_Stripe\StripeObject::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/StripeObject.php on line 402

Deprecated: Return type of WU_Stripe\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/gateways/stripe-php/lib/Collection.php on line 111

Deprecated: Creation of dynamic property WU_Page_Addons::$addon_count is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/class-wu-pages-addons.php on line 58

Deprecated: Creation of dynamic property WU_Page_Feature_Plugins::$addon_count is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/class-wu-pages-feature-plugins.php on line 51

Deprecated: Creation of dynamic property WU_Setup_Wizard::$parent_slug is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/setup/class-wu-setup.php on line 160

Deprecated: Creation of dynamic property WU_Plans_Limits::$user_id is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/class-wu-plans-limits.php on line 55

Deprecated: Creation of dynamic property WU_Plans_Limits::$plan is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/class-wu-plans-limits.php on line 58

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398
[👨‍💻🇻🇳] Hướng dẫn sử dụng tính năng Debug trong Visual Studio - Top1Vietnam - Top1Index - Top1List - Top1Brand
Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

Deprecated: preg_quote(): Passing null to parameter #1 ($str) of type string is deprecated in /www/wwwroot/hdd-vatly/re_mysql.top1index-top1list.com/wp-content/plugins/wp-ultimo/inc/mercator/mercator.php on line 398

[👨‍💻🇻🇳] Hướng dẫn sử dụng tính năng Debug trong Visual Studio

Debug là một công việc mà hầu hết người lập trình đều phải thực hiện để tìm lỗi trong phần mềm của mình. Visual Studio đã hỗ trợ khá mạnh tính năng này để giúp đơn giản hơn trong việc tìm lỗi sản phẩm. Trong bài viết này mình sẽ hướng dẫn các bạn sử dụng tính năng Debug trên phiên bản mới nhất của Visual Studio, hiện tại là bản 2015. Các thao tác sẽ được thực hiện trên Visual Studio Enterprise 2015.

Debug trong Visual Studio cho phép bạn chạy chương trình từng bước để xem sự thay đổi giá trị của biến, trả về của hàm,… qua đó phát hiện những lỗi logic trong chương trình.

Một số thành phần cơ bản

  • Breakpoints: Là điểm mà chương trình sẽ dừng lại để cho phép bạn chạy từng bước các dòng code. Có thể đặt nhiều breakpoint trong chương trình.

  • Các cửa sổ theo dõi biến: Giúp bạn theo dõi sự thay đổi của biến hoặc hàm cho mỗi bước chạy. Nếu một biến có sự thay đổi giá trị thì sẽ có màu đỏ để phân biệt. Có 3 loại:

    • Autos: Hiển thị tự động các biến, hoặc hàm trả về trong các dòng code trước.
    • Locals: Tương tự Autos nhưng chỉ hiển thị các biến liên quan trong nội bộ hàm hoặc khối lệnh.
    • Watch: cửa sổ tùy chỉnh cho phép bạn xem chỉ các biến mà bạn yêu cầu hoặc giá trị tùy chỉnh bất kỳ. Visual Studio cho phép bạn mở tối đa 4 cửa sổ Watch.

  • Thanh công cụ Debug: cung cấp các nút lệnh để bạn thực hiện Debug chương trình.

  • Cửa sổ Call Stack: Chứa lời gọi hàm trong ngăn xếp. Nếu chỉ debug ở mức độ cơ bản thì cũng không cần quan tâm cửa sổ này lắm.

  • Cửa sổ Diagnostic Tool: Chứa các công cụ chẩn đoán nâng cao. Cung cấp biểu đồ thời gian thực bộ nhớ, CPU,… mà chương trình sử dụng. Ngoài ra nó còn hiển thị các sự kiện được bắt và thời gian bắt.

Để bắt đầu thực hiện Debug, ta click vào rìa bên trái tại dòng code cần bắt đầu debug để đặt breakpoint. Breakpoint sẽ có màu đỏ như hình dưới. Lưu ý là có thể đặt nhiều breakpoint khác nhau. Để xóa một breakpoint ta click vào nó một lần nữa.

Sau khi đặt Breakpoints, ta bắt đầu chạy chương trình dưới chế độ Debug bằng cách nhấn phím F5. Chương trình sẽ chạy bình thường cho tới khi gặp một breakpoint như hình dưới.

Lúc này bạn sẽ sử dụng các nút lệnh trên thanh công cụ Debug để tiến hành chạy từng bước.

Các nút điều khiển Debug cơ bản:

  • Step Over (F10): chạy lần lượt các câu lệnh, tuy nhiên sẽ không đi vào trong hàm con mà chỉ lướt qua.
  • Step Into (F11): chạy lần lượt các câu lệnh và đi vào hàm con.
  • Step Out (Shift + F11): Lướt qua hàm con hiện tại để trở về hàm trước. Ngoài ra có thể dùng nó để nhảy qua breakpoint kế tiếp.

Trong quá trình Debug, bạn có thể di chuột đến bất kỳ biến nào để xem giá trị hoặc thay đổi giá trị của biến. Ngoài ra có thể ghim popup tại màn hình để tiện theo dõi.

Disable breakpoint

Nếu bạn có nhiều Breakpoints trong chương trình, muốn tạm không dùng một breakpoint nào đó mà không xóa nó. Bạn có thể disable bằng cách di chuột vào breakpoint đó, một popup hiện ra và chọn Disable breakpoint. Breakpoint bị disable sẽ có màu trắng như trong hình.

Debug có điều kiện

Visual Studio hỗ trợ bạn tính năng Debug có điều kiện. Nghĩa là chỉ thực hiện debug tại breakpoint khi thỏa một điều kiện nào đó. Để thực hiện bạn cũng di chuột vào breakpoint cần đặt điều kiện và chọn Settings trong popup hiện ra.

Lúc này bạn tick chọn Conditions và gõ vào một điều kiện phù hợp. Có thể thêm điều kiện bằng cách chọn Add condition. Lúc này breakpoint đã được đặt điều kiện (sẽ có hình dấu cộng) và sẽ chỉ dừng lại để debug khi thỏa điều kiện đó.

Trên đây là những kiến thức cơ bản khi sử dụng Debug trong Visual Studio 2015. Hi vọng sẽ giúp ích được cho các bạn.

#Hướng #dẫn #sử #dụng #tính #năng #Debug #trong #Visual #Studio

 ⭐ ☀ ⚡ 
Born to keep your brand's great stories forever!Bring your brand to the World !

Zalo FB Viber WA
Top1Vietnam - Top1Index - Top1List - Top1Brand
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart