Cannot see local class variables while debugging DLL in Visual Studio..? - vb.net

I'm trying to debug a DLL that I've written in VB.Net. When the external program starts, it loads the DLL and everything runs fine...but I cannot see the class variables in the Locals pane. They show up blank as shown below.
Also, some lines of code generate the error "There is no source code available for the current location", but I think I understand why. Whenever it tries to step into class members of any of the Microsoft DLLs, it would of course have no information for those. But any lines which deal only in code that I've written, it works fine.
This is a COM DLL AddIn for Microsoft Access 2007, but I'm assuming the issue is roughly the same regardless of the type of DLL. The Shared COM Addin Wizard was used to get started, and then customization proceeded from there with satisfactory results...except for the invisible variables in the Locals window.
I'm new to writing & debugging a DLL like this; until now I've only done EXE files. I've researched MSDN, Google, and Stack Overflow, and here are the details that are asked about on other threads...
Visual Studio 2008, .Net 3.0, and Access 2007
Project Properties > Debug > External Program points to MSAccess.exe.
Project configuration is set for Debug.
Optimizations = off.
Generate debug info = Full.
The PDB file is present in the \bin\ folder with the DLL.
Breakpoints are working.
Debug.Print messages are working.
I dug through the registry and found all references to the project, DLL, and its custom UserControl (required since the project creates a CustomTaskPane, and all path paths point to \bin\ folder.
What am I doing wrong?
What am I doing right?
What can I improve?

Ok, answering part of my own question. I think I fixed the error message "There is no source code available for the current location". In the project properties "Enable unmanaged code debugging" was enabled.
With that option disabled, I can now step through the code without error, even if it hits objects for which I have no code. The debugger is acting a little differently too, but I haven't yet pinned it down. I did read up on the differences between managed & unmanaged code, and debugging them in mixed combinations, but while I understand in principle, I don't yet understand in practice.
My local variables are still blank, though.

Alright, after working on this for days in between other projects, I have an answer...of sorts. I think the solution and/or projects had become corrupt. I'll pass along what I can in the hope it may help others.
Yesterday I had a marathon session of "click everything", in the project settings and Options > Debugging, but nothign helped. At some point I stopped fiddling with the debug settings and continued working on the code until I was tired and went home.
This morning with a fresh mind I tried again, and discovered the private class variables were now all visible. And I don't know why. Also, there was a new problem: the Just-In-Time debugger prompt kept popping up, even thought it wasn't enabled in the settings:
Also, the play/stop/step toolbar buttons would become disabled when they shouldn't be, yet the menu selections for the same items functioned normally.
I double-checked all settings again. I played with everything and could NOT get the local class variables to become invisible again, and could not get the JIT dialog to go away.
So I...
Made a copy of the solution folder.
Cleaned the solution.
Rebuilt the solution, including the Setup project.
Uninstalled the Setup project from Windows via Solution Explorer.
Cleaned the solution again.
Deleted the SUO file.
Deleted everything in \bin\ and \debug.
Rebuilt the solution, including the Setup project.
And still the problems persisted.
After the JIT prompt, I clicked Continue (F5), then closed MSAccess. Aafter execution stopped, some IDE panes (such as Explorer, Locals, etc) disappeared, and some flew around to random locations on the screen. It was then I decided something might be corrupt, and started making plans to uninstall/reinstall all of Visual Studio 2008 from scratch, and possibly even a new solution from scratch.
So before reinstalling, I tried creating a new solution from scratch, and found everything worked perfectly, even with all settings as they were from the original solution.
So in the original solution I...
Exported the settings from Tools > Import and Export Settings.
Reset all settings.
Imported the settings I just saved.
At the moment the import dialog closed, I received the error message: "An unexpected error has occurred".
When restarting the VS IDE, I received a dialog that said "Visual Studio is configuring the environment for first time use". That didn't sound good.
Tried importing the settings again, same error.
Rebooted, tried importing again, same error.
Closed the Solution file, tried importing the settings again without any solution open, and it worked....or seemed to.
Then opened the Solution...and same problems were back.
Exported the settings from the new Solution.
Imported those settings into the original solution...and it's fixed..?
There was no import error, and the project started working correctly..!!
The local class variables were visible, and the JIT prompt was gone..!!
So...I guess something was bunged up in the Solution, one of the Projects, the IDE settings, or...something. I hope this helps someone else.

Related

Visual Studio VB: The Operation Could Not Be Completed

I was using Visual Studio 2022 edition and it was working fine last night. When I tried to open it this morning, it gave me an error:
The operation could not be completed
I don't know what happened. I already have ran into few suggested solutions and nothing seems to work. I have tried:
closing and restarting the Visual Studio;
restarting my computer; and
deleting .suo, which I don't have unfortunately. I must also mention that upon closing the error message, I received another message:
Value does not fall within the expected range
Just in case they're connected problem. Any ideas?
It might be some type of corruption of files or something. Try reinstalling it to fix the files. Also make sure to turn on sync so your extensions and theme don't get lost.
#Jimi 's answer from the comments solved this problem.
With VS closed, remove the hidden .vs folder which is inside the main folder of your Solution. Then, for each Project, delete the content of the obj folder. Open the Solution in VS, right-click the Solution in Solution Explorer and clean / rebuilt it (clean may seem redundant at this point, but there's a reason for it)
In my case (VB programming) I had to go to Extensions->installed in the menu and enable: Web live preview. This seems to become disabled at new update.

VBA /Visual basic projects/macros issues while compiling

I have so many problems with any of the VBA/VB projects, that I am by now not sure which category these problems falls in. Some of the issues listed below may or may not be interrelated. But any thing that is related to visual basic project is causing me so many problems since 1 year.
I have researched so many time but have not got a solution till date :(.
But this time I could not stand it any more and therefore I am here to post it.
I had Microsoft visual basic 6.0 installed in my system last year. I was able to create some small windows based forms->compile and run as well. However, when I have a project from external resource for supporting VB applications, none of the project were compiling and running through IDE.
So i researched a lot and found the below issues:
Missing references/missing dlls. added references but no use
Tried help got this error: msdn collection does not exist please reinstall msdn
Tried Compiling - got error:
Compile error: cannot find project project or library
Tried adding components : failed by getting error Dlls are not registered.
Error in project loading, found the below error
Then I tried registering the MSCOMCTL.OCX file through regsrv.exe but it gave admin related errors as below
call toDllRegisterServer failed with error code 0x800280c
Even though I have all admin rights and I am logged in as admin for command prompt.
I also had copied the files from syswow64 to system32 or vice versa whichever way it did not work
Somewhere I had googled that we need to unblock the files to register , but these files were not blocked.
Tired, I just left the problem just like that due to other prioritised work.
But again today my colleague gave me an excel sheet which had macros written in it.
These macros do not run, instead it redirects me to Visual Basic for application IDE where the first window i get is Compile error followed by automation error
Again I thought of researching more on to it, and finally found from SO only that we should be registering MSCOMCTL.OCX.
But no matter what I do, I am unable to register any dlls.
Can any one tell me what is causing so much of compile issues , the solution and why I am not able to register any dlls or files?
And by the way, my system is window 7 64 bit and I seem to be only one in the workplace having this problem.
This issue was present even before any updates. The same profile with the same updates are running in my colleague's system. Even though there were no patch updates etc.
Try this:
Open a Command Prompt:
Open START menu, in Search box enter: cmd.exe, a link will shows, BUT doesn't press Enter key, instead RIGHT-CLICK on the link to open context menu, then choose Run as administrator
A Prompt DOS (black) windows will open on C:\Windows\System32 folder.
If your OS is 32 bit then type the below commands:
regsvr32 mscomctl.ocx press Enter
regtlib msdatsrc.tlb press Enter
If your OS is 64 bit, need to navigate to C:\Windows\SysWOW64 folder: Type the command:
CD C:\Windows\SysWOW64
then press Enter key to confirm.
Type the below commands:
regsvr32 mscomctl.ocx press Enter
regtlib msdatsrc.tlb press Enter
Now should working
HTH

Unable to install My program. Mostly has to do with Crystal Reports

Okay, This question has probably been asked before but I can't seem to solve it with anything that I've seen.
I published my program and tried setting it up on another computer. At first it gave me this error:
"Unable to install or run the application. the application requires that assembly microsoft.reportviewer.processingobjectmodel version 9.0.0.0 be installed in the global assembly cache (GAC) first."
After searching I found that including everything in the 'Application Files' before publishing made that go away, only to be replaced with
'Application cannot be started. Contact the application vendor.'
After searching and doing a lot of things on the computer that I want this program to be setup on, I checked (Crystal Report Basic For Visual Studio 2008 (x84, x64)) in the Prerequisite.
On the Computer that I need this program on, it won't download this at all. It gives me a message box to either retry or cancel.
Some pages suggest that the Crystal report package that automatically downloads is not the right one. When I tried following what is said here, I got stuck because the links won't open.
Any help appreciated, It's frustrating because I've been working on this program for months and I get stuck on the last step :/
oh .. and ... I don't know if this has anything to do with this, but I built the program using Windows 7, then updated to Windows 8, then updated to Windows 10.
I finally managed to make it work :)
Here is what I did:
I followed this video and I was able to install my program to the other computer.
When I opened it, I got a problem that the program can't find my MS Access DataBase, so I went to the setup project -> Right click -> add -> File, And I navigated to my original project's folder and added everything in there, and Viola! ... It works :)
I hope this helps somebody else :)

VB 2013 Error when trying to load designer or code for form "Make sure the application for file type (.vb) is installed

I have worked on an application for some time now and after booting up my PC today, entering VS 2013, opening my project and trying to load my main form an error popped up.
There is no editor available for (Location of form) Make sure the application for the file type (.vb) is installed
I have not uninstalled anything since last time the form worked, which was yesterday. My PC has a thing of sometimes randomly turning off, I don't know if that could have anything to do with the problem. I see several people with the same problem but they all seem to have a fix.
Involving re-installing some content that you have uninstalled and I do not think that is the case for me. When I execute the program VS prompts me saying that there are build errors, if I choose to run the last successful build the program works completely fine, but I still can't access the designer or code window.
This may be due to some reference file missing . Please make sure that all the references for the application is correctly added. If there is some file paths are shown like 'System can not find the reference specified' ,then remove the same and add them again from the correct path.

ClickOnce Application Not Opening

I have a VB.NET ClickOnce application that I am trying to install on my computer. Previously, I was able to install and run these apps without issue. Now when I install the application, I can see the flash of a window opening, and then nothing. (There are also no processes left hanging or anything when viewed with the task manager.)
After some digging around I noticed that there are files in my Temporary Internet Files with names like "FusionBindError" and then my application name and different DLL names.
I have done everything I can find on the net to do, reinstall applications, reinstalled the .NET Framework, deleted my Local Settings folder and relogged in.
Does anyone out there have any other ideas for me to try?
I tried the Mage.exe suggestion, but it failed to help. Same with the other installation location suggestion. The application flashes at the bottom of the screen but does not open. I have tried using FUSLOGVW to check the bindings and nothing shows up in there. (Good or bad, there are no binding entries.)
Have you tried using mage.exe? This is a command-line tool that comes with .NET framework. Start up a VS command prompt, and try mage -cc. This will clear your applicaiton cache and will force a new click-once download. This is the first thing I do when my click-once applications fail and it works 99% of the time.
A couple of suggestions:
FusLogVW isn't working for you because you have to enable assembly binding failure logging inside the registry. This MSDN article describes how to do this.
Another thing that comes to mind is, perhaps the ClickOnce app install, or perhaps the whole ClickOnce store is corrupted. Try deleting the ClickOnce app store then reinstalling the application.
It's possible that new prerequisites were added that you don't have on hand. If the URL you are using points directly to "my.application" or whatever your equivalent is, prerequisites won't be processed.
So try pointing to the setup.exe that is created in the same directory as the .application file.
Other than that, it sounds like you're doing all the right stuff...
Also, it could be useful to run the fuslogvw utility on a machine where the application actually works. Or reflector.
And then see if indeed any of its dependencies being loaded surprise you.
Also, for these types of errors, be sure to check if disabling the antivirus resident protection helps. Sometimes it causes problems accessing assemblies' manifests and such.
I uninstalled my Kensington Mouse software, and that resolved my installation errors.
Who knew that mouse software that I never used could cause so much trouble??
Sometimes if your machine is working for days this problem will show up. Try to restart your machine. The same problem happened to me and it disappeared when I restarted my machine.