Skip to main content
Solved

Debug an internal class

  • February 10, 2023
  • 3 replies
  • 342 views

param2022
Jr Varsity II
Forum|alt.badge.img

How can we debug an internal class ?? I am trying to debug ActivityHelper.cs from the 
App_Data\CodeRepository\PX.Objects\CR folder.

I am able to debug other files such as ContactMaint from the same folder. 

Best answer by Naveen Boga

Hi @param2022 

I got the below information from other sources.

 

Yes, you can debug another assembly's internal class in C#. However, you need to make sure you have the necessary permissions and access to the assembly's code.

By default, internal classes are only accessible within the same assembly, so you would need to change the accessibility level to the public or make use of the "InternalsVisibleTo" attribute in the AssemblyInfo.cs file to allow access to the internal class (Helper Class) from another assembly. Iā€™m NOT sure, whether Acumatica will allow us to change this.

Once you have the necessary access, you can use a debugger to step through the code and inspect the internal class as you would with any other class. Just keep in mind that changing the accessibility level of internal classes can impact the stability and security of the code, so use caution and make sure you understand the implications of making these changes.

View original
Did this topic help you find an answer to your question?

3 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 701 replies
  • February 10, 2023

param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • February 10, 2023

@jinin I already followed this article and was able to debug ContactMaint.cs but I am facing issue with this particular file which declares an attribute.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3404 replies
  • Answer
  • February 13, 2023

Hi @param2022 

I got the below information from other sources.

 

Yes, you can debug another assembly's internal class in C#. However, you need to make sure you have the necessary permissions and access to the assembly's code.

By default, internal classes are only accessible within the same assembly, so you would need to change the accessibility level to the public or make use of the "InternalsVisibleTo" attribute in the AssemblyInfo.cs file to allow access to the internal class (Helper Class) from another assembly. Iā€™m NOT sure, whether Acumatica will allow us to change this.

Once you have the necessary access, you can use a debugger to step through the code and inspect the internal class as you would with any other class. Just keep in mind that changing the accessibility level of internal classes can impact the stability and security of the code, so use caution and make sure you understand the implications of making these changes.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings