Re: App.Path in Class_Initialize (or VB Runtime threading bug?)

From: Tony Proctor (tony_proctor_at_aimtechnology_NoMoreSPAM_.com)
Date: 01/02/05

  • Next message: Tony Proctor: "Re: App.Path in Class_Initialize"
    Date: Sun, 2 Jan 2005 12:45:36 -0000
    
    

    The VB6 runtime is only safe in STA threads (i.e. what you call "apartment
    threading"). Both COM+ and IIS (which is itself a COM+ environment) offer
    this type of threading, and so VB6 should be OK.

    I know of no problems with Replace() or Dir(), or of any MS changes that has
    broken them. We use these environment extensively without encountering
    similar problems.

    One thing that's always work checking is that all your VB6 DLL have both
    'Unattended execution' and 'Retain in memory' set in their project
    properties. This is mandatory for it to be properly thread-safe in these
    environments.

            Tony Proctor

    "DJThompson" <DJThompson@discussions.microsoft.com> wrote in message
    news:43AE87DF-4341-496F-8D9D-D93567A6C700@microsoft.com...
    > We're having the same symptoms. For us, it appears to be a threading
    problem
    > with VB runtime. We have an ASP application calling a method in a
    component
    > registered in COM+ Services. Our code works fine (famous last words) but
    > when we call Replace() or Dir() in the VB Runtime (MSVBVM60.DLL) we get
    > "ActiveX component cannot create object". Our ASP pages work fine until
    the
    > site is under heavy load. We presume that as IIS starts using more and
    more
    > threads for serving requests, we end up calling the Replace() and Dir()
    > functions from multiple threads simultaneously. When this happens, some
    ASP
    > page requests will fail with the aforementioned error.
    >
    > We originally noticed the behaviour when continously pressing F5 very
    > quickly - some requests would fail.
    >
    > **We can reliably reproduce the error in the VB runtime** simply with a
    > small multi-threaded C# application (source available: post here to
    request)
    > which calls a method in a VB6 COM+ DLL multiple times simulaneously across
    > multiple threads. The VB6 DLL method just calls the Replace() function.
    As
    > a result, we get "ActiveX component cannot create object" errors arising
    from
    > making the Replace() call. This error is not arising as a result of
    > evaluating the parameters to the call.
    >
    > Our VB6 DLL is configured to use apartment threading - it appears that the
    > Replace() and Dir() functions no longer work in this model as the result
    of a
    > recent change by Microsoft.
    >
    > Does anyone know of a work-around until Microsoft notices & patches?
    >
    > Thanks!
    >
    >
    > "Jason R. Schmidt" wrote:
    >
    > > Hi, I am having a strange issue with a class in VB6. I am running a
    > > webserver using IIS on windows 2000 and an ASP UI. I am receiving
    random
    > > "activex can't create component" errors. If you refresh the page, the
    error
    > > goes away. If you refresh again, it will happen. This occurs randomly.
    If
    > > IIS is restarted, the web page doesn't encounter this error until around
    a
    > > week later.
    > >
    > > The class causing the problem built some logging path information in the
    > > Class_Initialize method by using the App.Path object. I determined this
    > > object was causing the problem because the error hasn't happened since
    we
    > > removed it.
    > >
    > > Just wondering if anyone had ever seen this?
    > >
    > > Thanks
    > >


  • Next message: Tony Proctor: "Re: App.Path in Class_Initialize"

    Relevant Pages

    • Re: vb6 Post April Fools Day Support Policy
      ... VB6 developers on .NET. ... > Premier Support for VB6 which took effect on April 1st. ... > new environment so I could do either. ... > is what they referred to as Critical Updates. ...
      (microsoft.public.vb.general.discussion)
    • Re: VB.NET advantages
      ... I work more with VB6, ... .NET environment or because they were considered outdated. ... install and work with both development environments in your OS environment. ...
      (microsoft.public.vb.general.discussion)
    • Re: VS.NET is 10 times slower than VB6
      ... you had to stop the Web Server to test. ... You really had no true debugging ... environment, so unless you were using VB6 Web Classes, there was no debugging ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: C.NET VS VB6
      ... development environment just as C# and J# C++.Net etc etc ... Well it is all a mather of preferences as a experienced VB6 and VB.Net ... Our proposed app's target features consist of a business ... target features closely match their capabilities. ...
      (microsoft.public.dotnet.languages.vb)
    • Re: Hosting object in COM+ vs IIS
      ... currently you have VB6 COM objects running inside a COM+ application. ... You can then start to replace your VB6 business objects one at a time with ... I would suggest staying away from DCOM, and instead stick with .NET Remoting ... > * We can scale out IIS 6.0 easily; ...
      (microsoft.public.dotnet.framework.performance)

    Loading