VS.NET strange behavior...

  • Thread starter Thread starter Shrishail Rana
  • Start date Start date
S

Shrishail Rana

Hello all,

Here's another mind puzzle from me :-)

Today I tried to add a new resource to my program and VS.NET (v 7.0.9466)
just died. What I mean by that is that it silently and quickly (immediately
actually) closed its window. No errors, no access faults - nothing. Just
died. I restarted it, tried to add a resource again and it repeated itself.
I rebooted the computer (which I haven't done in a few weeks now), but it
doesn't help :-( When I try to add a specific resource, it works fine (like
"Insert Bitmap" for example), it only dies when I press "Add Resource..."

I've been working on this program for the last month or so, I just didn't
add any resources recently, perhaps for a week or so. But I need to now :-)

Any thoughts?


With kindest regards

Shrishail Rana
 
Hi Shrishail,

Thanks for your post. As I understand, the problem you are facing is that
VS .NET crashes silently when you try to add resource to Visual C++
project. Please correct me if there is any misunderstanding. Now I'd like
to share the following informtion with you:

Based on my experience and research, there is a known issue that the
include path option ( under project properties or Tools options) exceeding
max no. of characters will cause the same problem. Please use one the
following two methods to work around it:

Method 1
========
Check the Project Properties -> Configuration Properties -> C/C++ ->
Additional Include Directories option and see if a long path is specified
there. Also check the Tools -> Options -> Projects -> VC++ Directories ->
Show Directories For : Include files. If possible reduce the length else
Copy them to clipboard manually while adding the new resource.

Method 1
========
I would also like to suggest another workaround using a macro to add
resource copying the include paths to clipboard.

Using a macro, we can temporarily remove the include directories, display
the Add Resource dialog, and then restore the include directories. This
prevents the crash.

1. On the View menu, point to "Other Windows", and then click "Macro
Explorer".
2. In the Macro Explorer window, expand the "MyMacros" node in the tree.
3. Right click the "Module1" child, and then click "New Macro". This will
open the Macros IDE.
4. In the Macros IDE, expand the MyMacros project in the Project Explorer
window.
5. Right click on References, and the click "Add Reference".
6. Select the "Microsoft.VisualStudio.VCProjectEngine" and then click the
Select button. Click OK to add this reference.
7. Open Module1 if it is not already open.
8. Go to the new macro and rename the sub to "AddRes".
9. At the top of the file, add the following imports statement:

Imports Microsoft.VisualStudio

10. Add the following code to the AddRes method:

Sub AddRes()
Dim props As Properties

props = DTE.Properties("Projects", "VCDirectories")

Dim VCCol As VCProjectEngine.IVCCollection
Dim VCPlat As VCProjectEngine.VCPlatform

VCCol = props.Item("Platforms").Object
VCPlat = VCCol.Item("Win32")

Dim strSave As String

strSave = VCPlat.IncludeDirectories.ToString

' Remove the include directories
VCPlat.IncludeDirectories = ""

' Launch the AddResource dialog
DTE.ExecuteCommand("Project.AddResource")

' Restore the include directories
VCPlat.IncludeDirectories = strSave
End Sub

11. Close the Macros IDE. Switch back to Visual Studio .NET.
12. Add a button for the macro on the toolbar by right-clicking the toolbar
area and then clicking customize. Optionally, you can add a keystroke for
this new macro.

At this point, you should be able to use this new "AddRes" macro to
successfully bring up the Add Resource dialog without crashing and without
needing to shorten your include directories list. Please be noted that it
doesn't fix the problem but instead offers another way of bringing up the
dialog successfully.

I am standing by for your result.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top