Webpart objects should be disposed ?

Hi,
I am looping through the webparts in a page using webpartmanager as shown below. Should i dispose web part objects.(inside for loop)
foreach (System.Web.UI.WebControls.WebParts.WebPart webPart in wpManager.WebParts)

In general, if there is a Dispose method, and you created the object, then you should call Dispose. But before you do, visit this page and search for "WebParts":
https://msdn.microsoft.com/en-us/library/office/ee557362(v=office.14).aspx  There they say to Dispose the SPLimitedWebPartManager, but I don't see System.Web.UI.WebControls.WebParts.WebPart listed there.
I would probably call it, especially if there are there any custom web parts.
Mike Smith TechTrainingNotes.blogspot.com
Books:
SharePoint 2007 2010 Customization for the Site Owner,
SharePoint 2010 Security for the Site Owner

Similar Messages

  • Which Objects should I target for integrating Eloqua REST API 2.0?

    Which Objects should I target for integration? and What are the possible use cases for the additional objects other than core objects?

    I am still trying to find a good REST API 2,0 document like the Bulk 2.0 document.  Book List: Oracle Marketing Cloud
    I did find this but is also not in depth:
    REST API - Documentation for Core Objects

  • How can I tell if a Graphics object has been disposed

    Any ideas?
    Thanks

    My goal is to find out if a graphics object has been disposed or not...
    ...but I'll play along. the application offers the user some nice graphics to amuse them, I use the Graphics object. In my endeavours, something isn't getting displayed where I expect it to, and I suspect that somewhere I'm accidentally disposing the graphics object. So, like checking for nulls, I want to debug the application and make sure the graphics context is as I expect.
    A bit of a side note, SWT will throw an exception if you try and use a "graphics" type object that has been disposed and has a method called, unsurprisingly enough, isDisposed(). Can you guess what it returns?

  • "Using" and SPRequest object was not disposed

    Just trying to understand what is happening here. I have an event receiver that currently is not working (yet to find the bug).
    The code is incredibly simple and uses 2 "using" statements as per best practise in order to ensure the the objects are disposed of.
    When I look in the ULS logs and get the error for my event receiver it is immediatly followed by the "SPRequest object was not disposed" messages that I'm sure you have seen.
    Given that my code is within a using statement how can this be true?
    If there is a problem does "using" not clean up after itself like a try/catch may?
    I could change my code to be try/catch and clean up within the finally block but I thought using might clean up.
    Is this not the case or am I misunderstanding something?
    public override void ItemAdding(SPItemEventProperties properties)
    base.ItemAdding(properties);
    string theCourseName = properties.ListItem.Title;
    using (SPSite site = new SPSite(properties.WebUrl))
    using (SPWeb web = site.OpenWeb())
    SPListTemplate theTemplate = web.ListTemplates["CourseFeedback"];
    web.Lists.Add(theCourseName + ", Feedback", "Feedback from the course you attended", theTemplate);

    Hi QPR_JAY,
    If full of the error message content is"An SPRequest object was not disposed before the end of this thread",here is an article about it, and gave the reason and solution.
    http://littletalk.wordpress.com/2010/07/06/an-sprequest-object-was-not-disposed-before-the-end-of-this-thread/ .
    A similar post:http://social.technet.microsoft.com/Forums/sharepoint/en-US/d12df69e-12fb-4fe9-8707-40e34a1faae0/sharepoint-uls-logs-an-sprequest-object-was-not-disposed-before-the-end-of-this-thread
    Qiao Wei
    TechNet Community Support

  • All session objects should be serializable to replicate error.

    Hi All,
    Having 'EmployeeBean' and it is having below properties with getters and setters methods
    private long emp_id;
    private String emp_name;
    private java.sql.Timestamp date_of_join;
    private boolean isActive;
    private int dept_no;
    Adding multiple employees(creating multiple EmployeeBean) into an ArrayList and storing this ArrayList into a Session object. This is working fine but when I move this code to production(cluster environment) it is throwing below error
    <Aug 23, 2011 2:15:40 PM EDT> <Error> <Cluster> <BEA-000126> <All session objects should be serializable to replicate. Check the objects in your session. Failed to replicate non-serializable object.
    java.rmi.MarshalException: failed to marshal update(Lweblogic.cluster.replication.ROID;ILjava.io.Serializable;Ljava.lang.Object;); nested exception is:
         java.io.NotSerializableException: my.company.beans.EmployeeBean
         at weblogic.rjvm.BasicOutboundRequest.marshalArgs(BasicOutboundRequest.java:90)
         at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:221)
         at weblogic.cluster.replication.ReplicationManager_1032_WLStub.update(Unknown Source)
         at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         Truncated. see log file for complete stacktrace
    Caused By: java.io.NotSerializableException: my.company.beans.EmployeeBean
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
         at java.util.ArrayList.writeObject(ArrayList.java:570)
         at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         Truncated. see log file for complete stacktrace
    Can someone please let me know, why I'm getting this error? The EmployeeBean should implement serializable? Is there any problems/cons to implement serializable?
    Having other bean(LoginBean) and I'm keeping this bean into session and it doesn't implement serializable, not getting any error for this bean(LoginBean). Only difference is LoginBean is not added to ArrayList.
    Why it is throwing error for EmployeeBean and not for LoginBean??
    Thanks in advance.
    Regards,
    Sharath.

    The EmployeeBean should implement serializable? - Yep Is there any problems/cons to implement serializable? - No
    Just add java.io.Serializable to the EmployeeBean, for example,
    public class EmployeeBean implements Serializable {
    }For LoginBean you have probably, configured to be in the session, by using faces-config.xml.
    In the case of EmployeeBean (or the object graph it is part of) have you used HttpSession.setAttribute(...)?
    Note that setAtttibute(...) is the trigger for an application server to replicate the object.
    In this case all objects in the object graph have to be serializable.
    Typically, objects should be Serializable when they are part of the session and you are using a clustered environment.

  • Cp6 - Change request (locked objects should never change!)

    Because of some issues I am experiencing in my Captivate project, I needed to hide a number of slides. To my utter disappointment, I found that after I unhid these slides, my locked objects/buttons lost all their "On Success: Jump To Slide actions" and defaulted back to "Continue"
    I would have grudgingly accepted this behavior, if those objects were not locked but I expect that regardless of dependencies, locked objects should never change!
    In my opinion, if a dependency is lost than it is acceptable for the internal logic can default to "Continue". Even better, display a publishing message stating that object x's dependency no longer exists.

    If you really feel this way, then you need to log a change request at this link:
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform&product=5
    Talking about it in a forum thread doesn't necessarily add it to the queue for any future version.

  • Why we don't dispose SPList object using or Dispose methods?

    Hi Friends,
    Why we don't dispose SPList object in SharePoint server side object model?
    Could you please explain me indetails.
    Thanks
    Tiru
    Tiru

    SharePoint objects like SPWeb, SPSite holds a reference to an SPRequest object which holds a reference to a SharePoint COM object that is responsible to communicate with the backend SQL server.
    In case that the SPWeb object is not disposed when it is no longer used, then the connection to the SQL server will stay open and the memory allocated by the COM object will stay in memory as the COM object has not been asked to close the connection and to
    release the memory. However, SPList doesn't hold a reference to SPRequest. Hence it doesn't need to be disposed.
    See this for more information: http://blogs.technet.com/b/stefan_gossner/archive/2008/12/05/disposing-spweb-and-spsite-objects.aspx
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • When you publish a webpart what should the debugging server be set to?

    Hi,
    I am trying to deploy a webpart in Visual Studio.
    First of all, it says which local site do you want to use for debugging? Should this be a SharePoint server on your local machine that you are using VS on which will be different from the remote server you deploy to? On my local pc there are 3 web sites
    - SharePoint - 80, SharePoint Central Administration v4 and SharePoint Web Services. Which one should it be?
    And if this is what you need to do then, when it comes to deploying the webpart, how does VS know where to deploy it to? Because the server will be elsewhere. Also should it be deployed to the app or web server?
    Thanks a lot.

    Hi,
    It is required to do the web part development in the machine with SharePoint Server installed cause we will need to use the SharePoint Object Model in our development,
    so please choose a site(you can use the “SharePoint - 80”) in the local server for “What local site do you want to use for debugging” option and the web part solution can be deployed to this site during our development.
    Here is a link about
    Create Visual Web Parts in SharePoint 2010:
    http://msdn.microsoft.com/en-us/library/ff597539(v=office.14).aspx
    If you want to publish it to other servers, there will be a solution package(.wsp) generated after we publish our solution, we can upload install this solution package
    to a specific server as you want.
    Deploy solution packages (SharePoint Server 2010)
    http://technet.microsoft.com/en-us/library/cc262995(v=office.14).aspx
    Best regards
    Patrick Liang
    TechNet Community Support

  • Which BUs Object should I use for archiving and linking to SalesDocuments

    Hi,
    I want to archive documents and link them to SalesDocuments, but I don't know which BUsiness Object I should use. Special Ones like BUS2030, BUS2031,... or the general Type VBAK. If I use VBAK I have the problem, that when I archive manually all with VBAK linked documenttypes are proposed, so that I can't control, which documents are allowed to be linked with for instance CustomerQuotation or SalesOrder.

    Hello Marc,
    For Sales Order user object type as BUS2032
    Customer Quotation- BUS2031
    Customer Inquiry - BUS2030
    BUS2033          Customer complaint order
    BUS2034          Customer Contract
    BUS2035          Customer scheduling agreement
    BUS2051          Customer outline agreement
    BUS2094          Credit memo request
    Hope this will answer your question.
    -Thanks,
    Ajay

  • Which object should i use ?

    Hi,
    I have a methode that returns several values of different types. Which objet should I use to return these values ? I thought of Vector but somebody told me that there is a better object than Vector.
    thanks for your help !
    Tex

    First, always use an interface over an object if it exists. So, your code should always declare the instance variable as List, not ArrayList or Vector or LinkedList. This allows the implementation to be optimized for the task at hand (e.g. LinkedList for arbitrary insertions or deletions of data, ArrayList for better Iterator performance, etc.) while using the interface for the common List methods (e.g., get(), add(), remove(), iterator(), etc.)
    Second, avoid Vector. Sun specifically states in the Collections tutorial that ArrayList is preferred over Vector.
    - Saish
    "My karma ran over your dogma." - Anon

  • Same objects should be changed automatically

    I want to add same several object(like div) to my website project.
    To do this, I design one and than copy for more.
    But I want that when I changed one the others should be changed(like div which has same class).
    How can I do this?

    I think what you want to do is create a Graphic Style of your object.
    Creating graphic styles in Muse from the Course Muse Essential Training

  • How many of these objects should I be able to insert per second?

    I'm inserting these objects using default (not POF) serialization with putAll(myMap). I receive about 4000 new quotes per second to put in the cache. I try coalescing them to various degrees but my other apps are still slowing down when these inserts are taking place. The applications are listening to the cache where these inserts are going using CQCs. The apps may also be doing get()s on the cache. What is the ideal size for the putAll? If I chop up myMap into batches of 100 or 200 objects then it increases the responsiveness of other apps but slows down the overall time to complete the putAll. Maybe I need a different cache topology? Currently I have 3 storage enabled cluster nodes and 3 proxy nodes. The quotes go to a distributed-scheme cache. I have tried both having the quote inserting app use Extend and becoming a TCMP cluster member. Similar issues either way.
    Thanks,
    Andrew
    import java.io.Serializable;
    public class Quote implements Serializable {
        public char type;
        public String symbol;
        public char exch;
        public float bid = 0;
        public float ask = 0;
        public int bidSize = 0;
        public int askSize = 0;
        public int hour = 0;
        public int minute = 0;
        public int second = 0;
        public float last = 0;
        public long volume = 0;
        public char fastMarket; //askSource for NBBO
        public long sequence = 0;
        public int lastTradeSize = 0;
        public String toString() {
            return "type='" + type + "'\tsymbol='" + symbol + "'\texch='" + exch + "'\tbid=" +
                    bid + "\task=" + ask +
                    "\tsize=" + bidSize + "x" + askSize + "\tlast=" + lastTradeSize + " @ " + last +
                    "\tvolume=" + volume + "\t" +
                    hour + ":" + (minute<10?"0":"") + minute + ":" + (second<10?"0":"") + second + "\tsequence=" + sequence;
        public boolean equals(Object object) {
            if (this == object) {
                return true;
            if ( !(object instanceof Quote) ) {
                return false;
            final Quote other = (Quote)object;
            if (!(symbol == null ? other.symbol == null : symbol.equals(other.symbol))) {
                return false;
            if (exch != other.exch) {
                return false;
            return true;
        public int hashCode() {
            final int PRIME = 37;
            int result = 1;
            result = PRIME * result + ((symbol == null) ? 0 : symbol.hashCode());
            result = PRIME * result + (int)exch;
            return result;
        public Object clone() throws CloneNotSupportedException {
            Quote q = new Quote();
            q.type=this.type;
            q.symbol=this.symbol;
            q.exch=this.exch;
            q.bid=this.bid;
            q.ask = this.ask;
            q.bidSize = this.bidSize;
            q.askSize = this.askSize;
            q.hour = this.hour;
            q.minute = this.minute;
            q.second = this.second;
            q.last = this.last;
            q.volume = this.volume;
            q.fastMarket = this.fastMarket;
            q.sequence = this.sequence;
            q.lastTradeSize = this.lastTradeSize;
            return q;
    }

    Well, firstly, I surprised you are using "float" objects in a financial object, but that's a different debate... :)
    Second, why aren't you using pof? Much more compact from my testing; better performance too.
    I've inserted similar objects (but with BigDecimal for the numeric types) and seen insert rates in the 30-40,000 / second (single machine, one node). Obviously you take a whack when you start the second node (backup's being maintained, plus that node is probably on a separate server, so you are introducing network latency.) Still, I would have thought 10-20,000/second would be easily doable.
    What are the thread counts on the service's you are using?; I've found this to be quite a choke point on high-throughput caches. What stats are you getting back from JMX for the Coherence components?; what stats from the server (CPU, Memory, swap, etc)?; What spec of machines are you using? Which JVM are you using? How is the JVM configured? What's are the GC times looking like? Are you CQC queries using indexes? Are your get()'s using indexes, or just using keys? Have you instrumented your own code to get some stats from it? Are you doing excessive logging? So many variables here... Very difficult to say what the problem is with so little info./insight into your system.
    Also, maybe look at using a multi-threaded "feeder" client program for your trades. That's what I do (as well as upping the thread-count on the cache service thread) and it seems to run fine (with smaller batch sizes per thread, say 50.) We "push" as well as fully "process" trades (into Positions) at a rate of about 7-10,000 / sec on a 4 server set-up (two cache storage nodes / server; two proxies / server.) Machines are dual socket, quad-core 3GHz Xeons. The clients use CQC and get()'s, similar to your set-up.
    Steve

  • What kind of view object should I create for this data model?

    I have an entity that has several dates. The dates are stored in a table separate from the entity, each entity date has a date type (open, close, interview, etc) associated with it. The DBAs idea (who else of course!) was to have the flexibility to add new types of dates for entities when needed.
    So you have tables like this -
    Table: EntityTable
    Columns: EntityId, EntityName
    Table: DatesTable
    Columns: EntityId, Date, DateTypeCd
    I need to display an editable ADF form where I can update the entity and the entity dates
    The ADF form would contain something like this -------
    Entity Name: []
    Opening Date: []
    Closing Date: []
    Interview Date: []
    What kind of view object would I need to create to achieve this?

    That would be a master-detail relation 1-* between 'entity' and 'entity dates'. If your dba has set up the foreign key association in the db and you use the wizard to create the business objects, jdev pick up the relation and create the correct master detail relation in the vo layer for you.
    By the way naming a table 'entity' is not a good idea when working with ADFbc. We all talk about entities when we relate to a business object (in this case a row of a table or entity object or EO). So it's hard to distinguish the two, your specific table 'entiyt' and the common term entity or EO which can be a row of any table.
    Timo

  • How should i dispose of dead macbook air?

    Ollllddd macbook air, broken significantly and now won't even charge up so I can strip stuff off it. How do I dispose of it now?
    Thank you!

    Are you concerned about environmentally friendly recycling, or are you concerned about assuring some sensitive data on your disks does not end up in the wrong hands?
    If the former, then follow FoxFifth's suggestion.
    If the latter, then check your local area for disk overhaulers (or a similar appropriate adjective).  Be prepared to pay some non-trivial fee for them to work on cleaning your disk.

  • How should i dispose of my damaged ipod battery?

    ipod batteries are lithium ion-polymer batteries.disposing them is an issue as concerns the environment.Plus my dad put  this ipod into the checkin luggage at the airport.This made the battery a small soft thing.After the incident at the airport the device didnt work at all.I took apart the device and hence would like to dispose of the battery as safely as possible.Please help me solve my dilemma.Because this battery has undergone X-rays at the airport.

    Your best be will be to ask around for any local retail stores/outlets that recycle batteries.  For example, we have an Interstate Batteries store in our city and they recycle almost all types of batteries at no cost.  Simply make a visit to the store and drop it off in the appropriate bin.
    B-rock

Maybe you are looking for