Saturday, March 31, 2012

Strange "ambiguous in namespace" complier error disappears with rebuild

Hi all.
I am using VS 2005 and VB.NET.
Lately as my Web Application is getting larger, I have been getting strange
compiler messages like the following:
--
Compiler Error Message: BC30560: 'controls_user_createquicksearchbar_ascx
'
is ambiguous in the namespace 'ASP'.
Source Error:
Line 9:
Line 10: <asp:Content ID="Content1" ContentPlaceHolderID="Content1"
Runat="Server">
Line 11: <uc1:CreateQuickSearchBar ID="CreateQuickSearchBar1"
runat="server" />
Line 12:
Line 13: <uc2:PCSavedSearches ID="PCSavedSearches1" runat="server" />
--
This typically occurs after I have made a change that is in a code-behind
page in which the offending User Control is placed and I do a complete
rebuild and then test.
After the error occurs without making any other changes to the code, I
simply do another full rebuild from within VS and the error goes away and
does not re-occur.
Has anyone experienced this? Is there a fix for it? It is becoming both
annoying and time-consuming.
TIA"John Kotuby" <JohnKotuby@.discussions.microsoft.com> wrote in message
news:%23ahALGOPIHA.5160@.TK2MSFTNGP05.phx.gbl...
> Hi all.
> I am using VS 2005 and VB.NET.
> Lately as my Web Application is getting larger, I have been getting
> strange compiler messages like the following:
> --
> Compiler Error Message: BC30560: 'controls_user_createquicksearchbar_ascx
'
> is ambiguous in the namespace 'ASP'.
> Source Error:
> Line 9:
> Line 10: <asp:Content ID="Content1" ContentPlaceHolderID="Content1"
> Runat="Server">
> Line 11: <uc1:CreateQuickSearchBar ID="CreateQuickSearchBar1"
> runat="server" />
> Line 12:
> Line 13: <uc2:PCSavedSearches ID="PCSavedSearches1" runat="server" />
> --
> This typically occurs after I have made a change that is in a code-behind
> page in which the offending User Control is placed and I do a complete
> rebuild and then test.
> After the error occurs without making any other changes to the code, I
> simply do another full rebuild from within VS and the error goes away and
> does not re-occur.
> Has anyone experienced this? Is there a fix for it? It is becoming both
> annoying and time-consuming.
> TIA
>
I have exactly the same problem. I have googled, asked here but no answers
/ solutions. Get out of the car and get back in. The only thing I can
think of is that depending on where my right hand is (on mouse or keyboard)
I will use F5 or click start debugging toolbar button. I always thought
that was the same but it seems that if I use only one of those combinations
I don't get the problem.
LS

Strang behaviour of multiselection Listbox

Hello,

i´d like to get access to the selected items of my listbox...

I did this in a loop, but I get only acces to the first selected item of the Listbox.

Has anyone solved the same problem? I really need help. Thx in advance.

Code (VB.net):

dim el as listitemfor each el in mylistbox.Items if el.selected then 'do something end ifnext

Give this a try...

 iCnt = 0 Dim li As ListItem For Each li In myListBox.Items If li.Selected Then iCnt += 1 Next If iCnt <> 0 Then Dim i As Integer iCnt = myListBox.Items.Count For i = 0 To iCnt - 1 If myListBox.Items(i).Selected Then 'Do Something End If Next
 End If
 Zath

Still the same problemSad
I´m sad...

But thank you for the try...

That shouldn't be.

Do you have this line in there?

If myListBox.Items(i).Selected Then

Zath


Yes...

No matter what I do, the first selected item returns true for .selected

the next ones return false...


ListBoxes (and CheckBoxLists) expose a new property called "GetSelectedIndices()"

So you can say

Dim LI As ListItem
For Each idx As Int32 in mylistbox.GetSelectedIndices()
LI = mylistbox.Items(idx)
'Do what you need to do with this selected list item
Next

*If* that doesn't work for you, and there is absolutely no reason why this code or the code you posted shouldn't... then you have other issues, like for instance, re-binding the list on every page load (which would "reset" the listboxbefore your event handler got a hold of the control)


I´m working on 1.1 so that the above function is not available for me...


But I will check the second issue. Thanks for the hint...


That did the trick... Sorry for the wasting of your time...

Did a wrong binding on PostBacks so I killed all of the selections except of one in the listbox...

*smashing head against the next wall*


i can't speak for the others replying on this topic... but you didn't/aren't wasting my time... glad to help out...

the whole binding cylce is a huge "gotcha" in .NET, we've all had our battles with it


(this is where you tell them "but it sure is great thatEasyListBox doesn't have that problem" Big Smile )

Strange "expected ;" error

I am getting an error and I can't seem to figure out why. The error is on line 32.

Compiler Error Message: CS1002: ; expected

Line 30: strScriptName=Request.ServerVariables("SCRIPT_NAME");
Line 31: strFolder="/buildlauncher/";
Line 32: If (strScriptName.IndexOf(strFolder)=-1)
Line 33: {
Line 34: strbuildlauncher="class='selected'";

The language I am using is C# and I don't seem to understand what a ; would be doing in an if statement. What I am trying to do is determine if the folder specified in the strFolder variable is in the server variable SCRIPT_NAME.There are some syntax problems here:

If (strScriptName.IndexOf(strFolder)=-1)

should probably be

if(strScriptName.IndexOf(strFolder) == -1)

Note the case sensitivity and the equality operator.

Strange "ambiguous in namespace" complier error disappears with rebuild

Hi all.

I am using VS 2005 and VB.NET.
Lately as my Web Application is getting larger, I have been getting strange
compiler messages like the following:
--------
Compiler Error Message: BC30560: 'controls_user_createquicksearchbar_ascx'
is ambiguous in the namespace 'ASP'.

Source Error:

Line 9:
Line 10: <asp:Content ID="Content1" ContentPlaceHolderID="Content1"
Runat="Server">
Line 11: <uc1:CreateQuickSearchBar ID="CreateQuickSearchBar1"
runat="server" />
Line 12:
Line 13: <uc2:PCSavedSearches ID="PCSavedSearches1" runat="server" />
--------

This typically occurs after I have made a change that is in a code-behind
page in which the offending User Control is placed and I do a complete
rebuild and then test.

After the error occurs without making any other changes to the code, I
simply do another full rebuild from within VS and the error goes away and
does not re-occur.

Has anyone experienced this? Is there a fix for it? It is becoming both
annoying and time-consuming.

TIA"John Kotuby" <JohnKotuby@.discussions.microsoft.comwrote in message
news:%23ahALGOPIHA.5160@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Hi all.
>
I am using VS 2005 and VB.NET.
Lately as my Web Application is getting larger, I have been getting
strange compiler messages like the following:
--------
Compiler Error Message: BC30560: 'controls_user_createquicksearchbar_ascx'
is ambiguous in the namespace 'ASP'.
>
Source Error:
>
Line 9:
Line 10: <asp:Content ID="Content1" ContentPlaceHolderID="Content1"
Runat="Server">
Line 11: <uc1:CreateQuickSearchBar ID="CreateQuickSearchBar1"
runat="server" />
Line 12:
Line 13: <uc2:PCSavedSearches ID="PCSavedSearches1" runat="server" />
--------
>
This typically occurs after I have made a change that is in a code-behind
page in which the offending User Control is placed and I do a complete
rebuild and then test.
>
After the error occurs without making any other changes to the code, I
simply do another full rebuild from within VS and the error goes away and
does not re-occur.
>
Has anyone experienced this? Is there a fix for it? It is becoming both
annoying and time-consuming.
>
TIA
>


I have exactly the same problem. I have googled, asked here but no answers
/ solutions. Get out of the car and get back in. The only thing I can
think of is that depending on where my right hand is (on mouse or keyboard)
I will use F5 or click start debugging toolbar button. I always thought
that was the same but it seems that if I use only one of those combinations
I don't get the problem.

LS

strange & weird problem in ASP.NET application

I am having a strange problem in my ASP.NET application. When
multiple users access the web site, the changes done by a user gets
reflected in another users session.

I have some global variables declared in a module which I use
throughout the application. Is it problem because of this? If I cant
declare a global variable in a module where else can I declare it
where it cannot be changed when multiple users are accessing the same
variable?

Please somebody help me.

-Shalinthat would be the difference betueen session variables and application
variables
you would need session variables
have a look at the pass variables value between diferent pages thread

hope it helps

eric

"shalin" <shalin@.imagine.co.in> wrote in message
news:2acc1eb4.0402260345.4dd44352@.posting.google.c om...
> I am having a strange problem in my ASP.NET application. When
> multiple users access the web site, the changes done by a user gets
> reflected in another users session.
> I have some global variables declared in a module which I use
> throughout the application. Is it problem because of this? If I cant
> declare a global variable in a module where else can I declare it
> where it cannot be changed when multiple users are accessing the same
> variable?
> Please somebody help me.
> -Shalin

Strange "Object reference not set to an instance of an object" error in webform

I suddenly received an unexpected error in my project. I have been working
on this project for some time without this issue. Nothing has changed in the
form that caused the exception. A little experimentation shows that I cannot
run ANY .NET web project without getting this error:

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

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 1: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="Login.aspx.vb" Inherits="DataBayWeb.Login" %>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <HTML
Source File: c:\inetpub\wwwroot\DataBayWeb\login.aspx Line: 1

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.Control.get_Controls()
System.Web.UI.Control.AddParsedSubObject(Object obj)

System.Web.UI.Control.System.Web.UI.IParserAccesso r.AddParsedSubObject(Objec
t obj)
ASP.Login_aspx.__BuildControlTree(Control __ctrl) in
c:\inetpub\wwwroot\DataBayWeb\login.aspx:1
ASP.Login_aspx.FrameworkInitialize()
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)

System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionSte
p.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Other developers on my team can run the latest version of the project
without an issue. What has happened?

ChrisVery strange indeed. It might sound obscure, but try removing the
space in <%@. Page...

Otherwise, I would be tempted to do the inevitable and reinstall the
framework.

Simon.

Strange "Object reference not set to an instance of an object" error in web

I suddenly received an unexpected error in my project. I have been working
on this project for some time without this issue. Nothing has changed in the
form that caused the exception. A little experimentation shows that I cannot
run ANY .NET web project without getting this error:
----
--
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 1: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="Login.aspx.vb" Inherits="DataBayWeb.Login" %>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <HTML>
Source File: c:\inetpub\wwwroot\DataBayWeb\login.aspx Line: 1
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.Control.get_Controls()
System.Web.UI.Control.AddParsedSubObject(Object obj)
System.Web.UI.Control.System.Web.UI.IParserAccessor.AddParsedSubObject(Objec
t obj)
ASP.Login_aspx.__BuildControlTree(Control __ctrl) in
c:\inetpub\wwwroot\DataBayWeb\login.aspx:1
ASP.Login_aspx.FrameworkInitialize()
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionSte
p.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
Other developers on my team can run the latest version of the project
without an issue. What has happened?
ChrisVery strange indeed. It might sound obscure, but try removing the
space in <%@. Page...
Otherwise, I would be tempted to do the inevitable and reinstall the
framework.
Simon.