Class file deleted but class is still available 
Author Message
 Class file deleted but class is still available

While playing with a new VB.NET project, I created a class ("clsPeople"),
added a property and a method, and then some code that would instantiate it
and generally prove that the class works. It worked - no problem. Then, I
deleted the file (clsPeople.vb) from disk using Windows Explorer; I did not,
however remove the reference to it from the project. I then went back to the
Visual Studio IDE and hit F5 - at which point I got the message, "There were
build errors. Continue?" - to which I responded "yes" to continue, then
tested to see if the functionality of the class was still available (fully
expecting that it would not be). I just wanted to see what would happen when
the file was deleted but still referenced in the project. The test worked
correctly - as it had prior to the file being deleted. That is, I could
instantiate objects from the class even though the file holding the class
code was deleted. I even rebooted the machine in case the class definition
was{*filter*} around somewhere in memory. The only things apparently different
after I deleted the file is that (1) I got the warning message; and (2)
there was a yellow warning icon next to the class file in the solution
explorer.

So now my question:
Why/how can a class be instantiated and used even after the file in which it
is defined has been deleted?

Thanks!

Jeff



Thu, 13 Oct 2005 14:27:04 GMT  
 Class file deleted but class is still available
Hello,


Quote:
> code was deleted. I even rebooted the machine in case the class definition
> was{*filter*} around somewhere in memory. The only things apparently
different
> after I deleted the file is that (1) I got the warning message; and (2)
> there was a yellow warning icon next to the class file in the solution
> explorer.

> So now my question:
> Why/how can a class be instantiated and used even after the file in which
it
> is defined has been deleted?

Try to delete the obj and bin folders in your project's directory.

Regards,
Herfried K. Wagner



Thu, 13 Oct 2005 20:51:51 GMT  
 Class file deleted but class is still available
Okay, but can someone provide an explanation of what's going on? I'd prefer
not to do something just because it works. I'd like to know why. Of course
I'd be happy to RTFM, but what topic would cover it?

Thanks.
Jeff



Quote:
> Hello,


> > code was deleted. I even rebooted the machine in case the class
definition
> > was{*filter*} around somewhere in memory. The only things apparently
> different
> > after I deleted the file is that (1) I got the warning message; and (2)
> > there was a yellow warning icon next to the class file in the solution
> > explorer.

> > So now my question:
> > Why/how can a class be instantiated and used even after the file in
which
> it
> > is defined has been deleted?

> Try to delete the obj and bin folders in your project's directory.

> Regards,
> Herfried K. Wagner



Fri, 14 Oct 2005 01:04:07 GMT  
 Class file deleted but class is still available
Hi Jeff ,

Where you responsed "Yes" to the message  "There were build errors.
Continue?", you actually terminated the compilation. The IDE then loaded
the latest version you successfully compiled before you deleted the source
file. To be exact, it loaded the assemly from the Bin folder. This is why
it seemed that the compilation continued.

To refresh the Solution Explorer, you can use the "Show All File" icon at
the top of the Solution Explorer.

Hope this helps.

Regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

Quote:
>Subject: Re: Class file deleted but class is still available
>Date: Sun, 27 Apr 2003 10:04:07 -0700
>Lines: 36
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

>Newsgroups: microsoft.public.dotnet.languages.vb
>NNTP-Posting-Host: 12-232-224-219.client.attbi.com 12.232.224.219
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:104174
>X-Tomcat-NG: microsoft.public.dotnet.languages.vb

>Okay, but can someone provide an explanation of what's going on? I'd prefer
>not to do something just because it works. I'd like to know why. Of course
>I'd be happy to RTFM, but what topic would cover it?

>Thanks.
>Jeff



>> Hello,


>> > code was deleted. I even rebooted the machine in case the class
>definition
>> > was{*filter*} around somewhere in memory. The only things apparently
>> different
>> > after I deleted the file is that (1) I got the warning message; and (2)
>> > there was a yellow warning icon next to the class file in the solution
>> > explorer.

>> > So now my question:
>> > Why/how can a class be instantiated and used even after the file in
>which
>> it
>> > is defined has been deleted?

>> Try to delete the obj and bin folders in your project's directory.

>> Regards,
>> Herfried K. Wagner



Fri, 14 Oct 2005 11:24:28 GMT  
 Class file deleted but class is still available
Thanks for the explanation - it all makes sense now.

One more thing - can you provide me with a recommendation for a book or MSDN
article or topic in online help or some other resource that would help me to
further understand what happens when compiling from the IDE, the purpose of
the \bin and \obj folders in the project's folder, etc...?

Thanks!

Jeff



Quote:
> Hi Jeff ,

> Where you responsed "Yes" to the message  "There were build errors.
> Continue?", you actually terminated the compilation. The IDE then loaded
> the latest version you successfully compiled before you deleted the source
> file. To be exact, it loaded the assemly from the Bin folder. This is why
> it seemed that the compilation continued.

> To refresh the Solution Explorer, you can use the "Show All File" icon at
> the top of the Solution Explorer.

> Hope this helps.

> Regards,

> Felix Wu
> =============
> This posting is provided "AS IS" with no warranties, and confers no
rights.



Fri, 14 Oct 2005 14:03:03 GMT  
 Class file deleted but class is still available
Hi Jeff,

I do not know the exact resource for this topic in detail, but you might
find some in VS.NET online help. In addition, the following link touchs a
part of the topic:

Could not create output directory 'directory'. <reason>
http://msdn.microsoft.com/library/en-us/vbref/html/vberrCouldNotCreat...
DirectoryDirectoryReason.asp

Regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------



Quote:
>Subject: Re: Class file deleted but class is still available
>Date: Sun, 27 Apr 2003 23:03:03 -0700
>Lines: 37
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

>Newsgroups: microsoft.public.dotnet.languages.vb
>NNTP-Posting-Host: 12-232-224-219.client.attbi.com 12.232.224.219
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:104285
>X-Tomcat-NG: microsoft.public.dotnet.languages.vb

>Thanks for the explanation - it all makes sense now.

>One more thing - can you provide me with a recommendation for a book or
MSDN
>article or topic in online help or some other resource that would help me
to
>further understand what happens when compiling from the IDE, the purpose of
>the \bin and \obj folders in the project's folder, etc...?

>Thanks!

>Jeff



>> Hi Jeff ,

>> Where you responsed "Yes" to the message  "There were build errors.
>> Continue?", you actually terminated the compilation. The IDE then loaded
>> the latest version you successfully compiled before you deleted the
source
>> file. To be exact, it loaded the assemly from the Bin folder. This is why
>> it seemed that the compilation continued.

>> To refresh the Solution Explorer, you can use the "Show All File" icon at
>> the top of the Solution Explorer.

>> Hope this helps.

>> Regards,

>> Felix Wu
>> =============
>> This posting is provided "AS IS" with no warranties, and confers no
>rights.



Sat, 15 Oct 2005 11:07:54 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Dim obj As New Class crt Dim Obj As Class = New Class

2. derive class from protected class in base class

3. #Classes not available in .mde file MsAccess97

4. Class of control was not a loaded control class - Reference Replaced with unknown .OCA file

5. how to take the class value out of a class file

6. Delete item from a collection class that has no Delete method

7. What CLASS am i?

8. Make VBA Class Modules Available Out-of-Process

9. make class procedures available

10. Linked List Class Available

11. Making VC++ class available to VB...

12. VB 4 Class Tool Beta Available!

 

 
Powered by phpBB® Forum Software