0

I'm using

SPListItem someItem = web.Lists[listName].AddItem(string.Empty, SPFileSystemObjectType.Folder, listRelativeFolderUrl)

to add a folder to an empty library. When I call

someItem.Update()

The debugger just sits and processes that line, but never finishes. This is an empty library, there is absolutely nothing in it. What could be wrong here?

4
  • It seems that item.Update() does not work when the debugger is active (i.e. a breakpoint is set on that location (or one before it) and I step over it). If I put a breakpoint on the line after, it seems to work and the item is created. This isn't really the 'answer' but can anyone explain why this is happening?
    – Paul
    Feb 24, 2015 at 20:02
  • if you set a breakpoint, it's going to stop on that line regardless of what code's on it. remove the breakpoint.
    – jpollar
    Feb 24, 2015 at 21:10
  • @jpollar I'm well aware of that. The problem was, when the breakpoint was on item.Update(), I pressed Play and the debugger could not process the item.Update() call. I've seen this before. Sometimes certain function don't work well with a debugger attached, especially for COM objects.
    – Paul
    Feb 25, 2015 at 17:10
  • I've never witnessed that. Yes, it hangs until you take the next step. It's supposed to do that. Did you get an error? Or a timeout at least?
    – jpollar
    Feb 26, 2015 at 15:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.