?
Solved

Compilation error trying to construct a Thread instance in JScript.Net

Posted on 2007-11-16
5
Medium Priority
?
352 Views
Last Modified: 2008-02-01
I have an ASPX page written in JScript.net that will do something and then start another thread do do some more stuff and return to the user. The thread will continue executing to complete its task (logging).

However, I am unable to create the thread in JScript.Net like I can in C# - it gets a compile error because the Thread constructor has 2 overloads that take a single argument and the compiler can not tell which one to use.

Here is a sample piece of code you can use to reproduce the compile error.

Thanks,
Gary Davis


<%@ Page Language="JScript" %>
 
<%
/*
	Small test case of compilation error on the first statement constructing the Thread instance.
	
	Error is:
	
		Description: An error occurred during the compilation of a resource required to service this request. 
				Please review the following specific error details and modify your source code appropriately. 
 
		Compiler Error Message: JS1184: More than one constructor matches this argument list
 
*/
 
 
var t : System.Threading.Thread = new System.Threading.Thread(DoSend);
t.Start("string");
 
function DoSend(s : String) {
	var stURL : String = s;
}
%>

Open in new window

0
Comment
Question by:Gary Davis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20315929
Check to see if there is anything on http://msdn2.microsoft.com/en-us/library/wdk85zxa(VS.71).aspx
that will help you understand what JS1184 means.

The resolution given is : Check the data types accepted by the overloaded constructor and make sure the data types of the arguments match only one overloaded constructor.
0
 
LVL 18

Author Comment

by:Gary Davis
ID: 20317572
Yes, I saw that article and was not able to coerce the parameter such that the compiler error was resolved.
0
 
LVL 18

Accepted Solution

by:
Gary Davis earned 0 total points
ID: 20342811
Well, with no solution, the best I could do was to change <% and %> to use <script runat="server"> and put the code in a Page_Load function (necessary for some reason).

Then, I dropped the idea of the separate thread and instead used a WebClient method that requests a web page asynchronously (that's the "something" I wanted to do in the thread). This did require the async="True" setting on the @Page statement.

Gary
0
 
LVL 1

Expert Comment

by:modus_operandi
ID: 20371114
Closed, 500 points refunded.
modus_operandi
EE Moderator
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question