Microsoft Content Management Server - SP2, SP1a channel manipulation bug?

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > January 2006 > SP2, SP1a channel manipulation bug?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author SP2, SP1a channel manipulation bug?
Martin

2006-01-24, 7:50 am

Hi Stefan,

I have a little class to help with channel navigation in my CMS site.

In the constructor I have the following code
Dim currentChannel, tmpChannel As channel
Dim tmpLevel As Integer
Dim appSR As AppSettingsReader

currentChannel = CmsHttpContext.Current.Channel
' rootChannel = CmsHttpContext.Current.RootChannel()
' Work around for spurious bug accessing RootChannel()

' Work out what leve the current channel is at
_level = 0
++ tmpChannel = currentChannel
While Not tmpChannel.IsRoot
tmpChannel = tmpChannel.Parent
_level += 1
End While
_rootChannel = tmpChannel

' Get level 1 channel
xx currentChannel = CmsHttpContext.Current.Channel
** tmpChannel = currentChannel
tmpLevel = _level
While tmpLevel > 1
tmpChannel = tmpChannel.Parent
tmpLevel -= 1
End While
'tmpChannel now has level 1 channel in it if one exists

Before I put in the line marked xx, the line marked ** fails with a null
reference exception. I can't understand it as the line marked with ++ above
works fine. It looks like a CMS bug to me, but I might have missed
something (??)

Why is it necessary to have the line xx to make this work? I have only
tried the work around with SP2.

Thanks
Martin


Stefan [MSFT]

2006-01-24, 7:50 am

Hi Martin,

what kind of problem do you get?
An exception?
What kind of exception?
Is there a call stack coming with this exception?
Did "currentChannel" get an instance in the first assignment?
If yes: does currentChannel contain "null" or not in the ** line?

Actually the code should work fine.
This would either be a bug or a database inconsistancy.

Please open a support case to get this analyzed in more details.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------


"Martin" <x@y.z> wrote in message
news:%235C9MNNIGHA.3944@tk2msftngp13.phx.gbl...
> Hi Stefan,
>
> I have a little class to help with channel navigation in my CMS site.
>
> In the constructor I have the following code
> Dim currentChannel, tmpChannel As channel
> Dim tmpLevel As Integer
> Dim appSR As AppSettingsReader
>
> currentChannel = CmsHttpContext.Current.Channel
> ' rootChannel = CmsHttpContext.Current.RootChannel()
> ' Work around for spurious bug accessing RootChannel()
>
> ' Work out what leve the current channel is at
> _level = 0
> ++ tmpChannel = currentChannel
> While Not tmpChannel.IsRoot
> tmpChannel = tmpChannel.Parent
> _level += 1
> End While
> _rootChannel = tmpChannel
>
> ' Get level 1 channel
> xx currentChannel = CmsHttpContext.Current.Channel
> ** tmpChannel = currentChannel
> tmpLevel = _level
> While tmpLevel > 1
> tmpChannel = tmpChannel.Parent
> tmpLevel -= 1
> End While
> 'tmpChannel now has level 1 channel in it if one exists
>
> Before I put in the line marked xx, the line marked ** fails with a null
> reference exception. I can't understand it as the line marked with ++
> above works fine. It looks like a CMS bug to me, but I might have missed
> something (??)
>
> Why is it necessary to have the line xx to make this work? I have only
> tried the work around with SP2.
>
> Thanks
> Martin
>



Martin

2006-01-24, 6:06 pm

Hi Stefan,

It's a null reference exception I get. The call stack stops at the ** line.
The currentChannel did get an instance in the first assignment, and so far
as I can tell it's value looks as expected on the second line where I use it
(ie. it's not null, and the channel display name is as expected).

As I have a work around, I don't want to raise a call which may turn out to
be chargeable. However I don't mind troubleshooting if there would be no
charge.

Thanks
Martin

"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:%23CwVkTOIGHA.3036@tk2msftngp13.phx.gbl...
> Hi Martin,
>
> what kind of problem do you get?
> An exception?
> What kind of exception?
> Is there a call stack coming with this exception?
> Did "currentChannel" get an instance in the first assignment?
> If yes: does currentChannel contain "null" or not in the ** line?
>
> Actually the code should work fine.
> This would either be a bug or a database inconsistancy.
>
> Please open a support case to get this analyzed in more details.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS:
> http://tinyurl.com/6zj44
> Check out the new book as well: Advanced MCMS development:
> http://tinyurl.com/8ugwj
> ----------------------
>
>
> "Martin" <x@y.z> wrote in message
> news:%235C9MNNIGHA.3944@tk2msftngp13.phx.gbl...
>
>



Stefan [MSFT]

2006-01-24, 6:06 pm

Hi Martin,

actually you should get an instance for the first line.
No idea why it does not work.
Without a support case it's hard to analyze this issue.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------


"Martin" <x@y.z> wrote in message
news:O$3M5JQIGHA.964@tk2msftngp13.phx.gbl...
> Hi Stefan,
>
> It's a null reference exception I get. The call stack stops at the **
> line.
> The currentChannel did get an instance in the first assignment, and so far
> as I can tell it's value looks as expected on the second line where I use
> it (ie. it's not null, and the channel display name is as expected).
>
> As I have a work around, I don't want to raise a call which may turn out
> to be chargeable. However I don't mind troubleshooting if there would be
> no charge.
>
> Thanks
> Martin
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:%23CwVkTOIGHA.3036@tk2msftngp13.phx.gbl...
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com