Resolving reference to non-shared member requires an object reference

Posted on 2006-05-01
Medium Priority
Last Modified: 2008-02-20
I understand this compile error message in the context of simple windows objects but I am confused how to resolve in this case:

I've recently learned I cannot debug classic ASP within Visual Studio 2005 (none of my breakpoints are reached).

So, according to:                  http://blogs.msdn.com/greggm/archive/2006/03/15/552108.aspx

...I am trying to use the add-in wizard to implement the macro documented in item 2 in the weblog reference above. Here is the key snippet from the code I am trying to use:

Imports System
Imports Microsoft.VisualStudio.CommandBars
Imports Extensibility
Imports EnvDTE
Imports EnvDTE80

Public Class Connect
    Implements IDTExtensibility2
    Implements IDTCommandTarget
    Dim _applicationObject As DTE2
    Dim _addInInstance As AddIn
    Public Sub Exec(ByVal commandName As String, ByVal executeOption As vsCommandExecOption, ByRef varIn As Object, ByRef varOut As Object, ByRef handled As Boolean) Implements IDTCommandTarget.Exec
        handled = False
        If executeOption = vsCommandExecOption.vsCommandExecOptionDoDefault Then
            If commandName = "debugClassicASP.Connect.debugClassicASP" Then
                handled = True
                Exit Sub
            End If
        End If
      End Sub
    Sub ClassicASPAttach()
            Dim os As System.Version = System.Environment.OSVersion.Version
            Dim IISProcess As String = "w3wp.exe"
            If os.Major = 5 And os.Minor < 2 Then
                IISProcess = "dllhost.exe"
            End If
            Dim processFound As Boolean = False
            Dim process As EnvDTE80.Process2
            For Each process In DTE.Debugger.LocalProcesses                              '<---- ERROR: reference to a non-shared member requires an object reference
                'Determine if the process could the IIS worker process
                Dim processName As String = process.Name.ToLowerInvariant()
                Dim processBaseName As String = System.IO.Path.GetFileName(processName)
                If Not processBaseName = IISProcess Then
                    If Not processBaseName = "inetinfo.exe" Then
                        Continue For
                    End If
                End If
                'Determine if the process contains asp.dll
                Dim aspLoaded As Boolean = False
                Dim diagProcess As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessById(process.ProcessID)
                Dim diagModule As System.Diagnostics.ProcessModule
                For Each diagModule In diagProcess.Modules
                    Dim moduleName As String = System.IO.Path.GetFileName(diagModule.FileName).ToLowerInvariant()
                    If moduleName = "asp.dll" Then
                        aspLoaded = True
                        Exit For
                    End If
                'If the process contains asp.dll, attach to it
                If aspLoaded Then
                    processFound = True
                End If
            If Not processFound Then
                MsgBox("Could not find this IIS process. Hit a web page containing classic ASP script so that the process will start.")
            End If
        Catch ex As System.Exception
        End Try

    End Sub
End Class

Question by:jjamjatra
  • 3
  • 2
LVL 96

Expert Comment

by:Bob Learned
ID: 16582466
There is the Tools | Attach to Process command to connect the debugger to the worker process.


Author Comment

ID: 16586448
Please read the weblog on MSDN if you would like to help me.

ASP cannot be debugged via Visual Studio 2005. I have tried and the breakpoints do not get stopped on. Attempting to attach to the worker process also does not work (buttons remain disabled). According to the MSDN entry this is by design.

Therefore, my question is about the compile time problem I am getting with the "workaround" discussed in the same weblog. Can anyone point out how to resolve this problem with the DTE reference that is required?
LVL 96

Expert Comment

by:Bob Learned
ID: 16587255



Author Comment

ID: 16587575
Thank you. That solved the problem. What do I have to do now to close this case?
LVL 96

Accepted Solution

Bob Learned earned 1000 total points
ID: 16587723
There should be an <Accept> button.   Click it, and give me an "A" grade.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question