Visual Studio Code Extension for Epicor 10 Customization

Thanks found solution

2 Likes

@yusuff I recommend you try the Visual Studio (Big Boy) Extension instead the visual studio code and omnisharp are just not quite there yet I did it as an experiment.

But I am actively maintaining the one for Visual Studio Proper

Okay, I got the extension installed and configured for epicor 2022.2.x,

I was able to select my customization and create the project in visual studio just fine.

Problem I am having is debugging with dnSpy, the debugger just doesn’t launch,
(I can launch it standalone)

When I attempt to debug, the epicor “pick your customization” dialog comes up (because I do have developer mode on) , I select my version, and leave “Debug in Visual Studio” turned off.

I then get an unhandled exception, it appears to be related to dnSpy, here are the details:
(notice the “CommonCode.EpicorLauncher.RunDnSpy(CommandLineParams o)” line
which calls “System.IO.Directory.GetFiles(String path, String searchPattern)”
and the exception is on the null “path” parameter

************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: path
at System.IO.Directory.GetFiles(String path, String searchPattern)
at CommonCode.EpicorLauncher.RunDnSpy(CommandLineParams o) in C:\Users\jcgomez\Source\Repos\epicor-editor-helper\CommonCode\EpicorLauncher.cs:line 453
at CustomizationEditor.NonModalWokIt.btnDebug_Click(Object sender, EventArgs e) in C:\Users\jcgomez\Source\Repos\epicor-editor-helper\CustomizationEditor_2022.2\NonModalWokIt.cs:line 99
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

My dnSpy is located in “C:\Programs\dnSpy”, and that is what I have the extension configured as for the location of dnSpy

Any thoughts ?

thanks, Scott

The DNSpy debugger feature I haven’t upgraded in a while. DNSPy got a pretty large re-write recently, I’m not sure is going to work without some significant effort.

what is your technique for debugging then ?

using the visual studio debugger (selecting the checkbox when the form starts) and keeping the VS instance with the extension in it running so you can synch your changes with epicor ?

Yeah I debug using Epicor’s “native” debugger when I need to.

You can debug directly in Epicor, so there isn’t really a reason to do that.

If you use dotPeek you can build .pdb files and your own Symbol Server and then point Visual Studio to your symbols and you can then step-into Epicor Client side code as well, it will auto-decompile it, or you just buy .NET Reflector and use the VS Plugin.

Slightly confused about a couple of things, (testing/playing with upload/download/autosynch)…

  1. upload/download appears to work fine (assuming I remember to save first)
    except that if the toolbox is open it doesn’t work at all
    if I hit download or upload the toolbox just flashes and nothing happens
    intentional ?

  2. What is the difference between “Edit/Run” and “Run (Test)” ?
    it appears maybe that “Run (Test)” executes with debug mode off
    (cuz I can’t select my customization when form opens)
    and “Edit/Run” executes with debug mode on
    (this gives me the opportunity to check the “Debug in Visual Studio” checkbox)

  3. Does/should auto synch work with “Run (Test)” ?
    auto synch works find with “Edit/Run” but does not with “Run (Test)”
    (I applied a change in VS, saved it, did a “Run (Test)”, then closed the form
    and opened it in Kinetic manually and my change was not there)

Thanks, Scott

Are you using this on Visual Studio code or Visual Studio (big boy)

The Visual Studio Code version I quit working on because at the Time VS Code didn’t work great with C#

There Visual Studio version though is newer and probably has some fixes on the extension side

While most things are driven from the helper library there are some things in the IDE extension that are needed which didn’t work great in VS Code

I am using Visual Studio 2017 (big boy)
I think I understand now why it appeared to me that “Run (Test)” didn’t apply my changes
I tried a message box and that worked, it just doesn’t persist the changes once the form is closed

Seems like that’s an intentional feature,
it gives you the option to do a quick test of some changes without persisting them on the epicor side

I’m all good with it now - thanks !

Scott

1 Like

Haso

I’ve explored dotPeek based on your previous reply.

I am able to generate the PDB files and see them being loaded by the VS symbol server when I start debugging…but, I can’t seem to step into any Epicor calls.

I noticed in the dotPeek documentation it talks about Optimized DLLs and that they won’t support debugging…it seems most of the Epicor dll’s are indicated as “Optimized” when I view the list of loaded modules in VS (Debug → Windows → Modules in the menu)

Do you have an example of a DLL and related call that you are able to use this feature with ?

Thanks, Scott

You have to go into settings of VS and find a setting that says “Just my code” and uncheck it, otherwise VS wont step into pdb files. Attached are some docs made by @Julieb215

Is there a reason why you can’t use the checkbox in Epicor that does this nativelly?

I think he just wants to use Epicor Native but also be able to step into lets say Infragistics or EpiUltraCombo class just to see the entire execution. Thats what the Symbol Server does w/ dotPeek unless you buy .NET Reflector + VS plugin.

Which checkbox are you referring to ?
maybe the “Debug in Visual Studio” checkbox on the “Select Customization” form ?
Or am I missing something ?

I am using that checkbox, but sometimes I’m curious about what a method is doing “under the covers” and would like to step into it.

1 Like

To set up Epicor Server debugging with VS and dotPeek.docx (161.4 KB)

PS: It has nothing to do with Epicor Server… when she mentions server she means pdb symbol server.

1 Like

Any ideas?

This version has been deprecated please use the Visual Studio Proper vesion