interop question
I have a C API like that:
==== C-API.h ====
typedef double NSTimeInterval;
NSTimeInterval GetTimeSince1970();
===============
Now I have a code generator parsing the headers and automatically
generating:
==== Generated.cs ====
class Wrapper
{
[DllImport(...)]
public extern static NSTimeInterval GetTimeSince1970();
}
where
[StructLayout(LayoutKind.Sequential)]
struct NSTimeInterval
{
public seconds timeinterval;
}
========
but that doesn't seem to work.
while the C call return correct value, C# test return me stupid random like
value.
what's even weirder I think it used to work well, the only breaking change I
could see is that I'm now using .NET 2.0 final release.
Any tips/thoughts?
--
Regards,
Lloyd Dupont
NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com> Tag: Switching thread context Tag: 108733
Registering VC# Express Offline??
Hello,
I have downloaded the VC# Express online on a computer,
and by copying the installation files from the temp directory
I installed it on the other one which is offline.
The installation was completed and VC# is running.
However, it pops up nag-balloons and asking me to
register it. Since the computer is cut offline from the web,
the registration is impossible. How to get rid of the
nag-balloons?
--
Best Regards,
W. Jordan Tag: Switching thread context Tag: 108729
IsInRole from ASP.NET failing
Hi All,
I'm attempting to restrict access to my ASP.NET application using role
based security. I'm using .NET v1.1
In code I check IsInRole for a local machine group, and it returns
false. The name of the group is properly qualified with machine name
in caps, and a forward slash (actually 2 'cause I'm using c# w/o @) and
then the name of the group properly cased, yet it fails to find it.
I found code on the internet that lets you see what groups IsInRole is
checking against, and I do not see this group in there. I have 99
entries. I've tried a variety of tests like adding new groups that the
user is a member of, removing group membership for groups the user is a
member of, and nothing works. I still have 99 entries, and the groups
that I remove the user from being a member of still appear in the list
of groups the user is allegedly a member of. I've also tried rebooting
the server, resetting IIS, clearing my temporary internet files cache,
and nothing seems to make it work. I did check to see that IsInRole
would be satisfied by providing a group that shows up in the group
membership enumeration, and that does work.
Anyone run into anything like this before or have any suggestions for
me?
Your help is appreciated! Tag: Switching thread context Tag: 108728
unable to find /aspnet_client/system_web/1_1_4322/webuivalidation.
I have a sharepoint server
I have an asp.net application it is a virtual directory and is defined in
sharepoint as an excluded path.
I have validators in datagrid, I run app and
I get the message "unable to find script library
/aspnet_client/system_web/1_1_4322/webuivalidation.js"
run aspnet_regiis -c did that no change
tried another fix, copied the aspnet_client folder into virtual directory root
still get the error
what can i set?
--
cindy Tag: Switching thread context Tag: 108727
Trace.Listeners questions
A few questions about the Trace.Listeners. I was looking at the samples
on MSDN, and wrote a small sample App. I used a TraceSwitch to
determine the which messages I should print, and Added two trace
listeners, one for a log file, and the other for the event log. The
code works OK.
First problem: For the EventLogTraceListener, all event log entries are
coming out informational. I want some to have severity of error. Is
there any built in facility for this, or does anyone have suggestions
on how to get this effect?
Second problem: In Java, I'm pretty sure that the equivolent trace
facility has some kind of formatter class, so that you can determine
exactly what the output should look like. For instance, I seem to
remember an XML formatter, for example. Is there anything like this for
System.Diagnostics.Trace?
Thanks. Tag: Switching thread context Tag: 108723
How to update the ASPNETDB file (login control) with a GridView (asp.net 2.0)
Hello
I am beginning to feel sorry that i am using the asp.net 2.0 login
controls.. it feels it makes you limited and you do not have much
support about it..
I managed to view aspnet_Membership and aspnet_Users into 1 GridView
using the SqlDataSource control
I can't figure out how to Initialize the built in Update in the
GridView so i could update user information from the gridview
(including UserName, Password and other stuff i added manually to the
database when a user register), or i need to do it manually?
I already managed to delete a user with GridView1_RowCommand detecting
the button pressed and doing Membership.DeleteUser(row.Cells[3].Text ,
true);
Does anyone can please help me here :\ Tag: Switching thread context Tag: 108722
deployment of .net 2.0 assembly exposed to COM (interop)
Hi,
I need to write an application which will then be executed by being called
from a COM application.
It has been suggested to me that I should use the updater application block,
but I wondered about the click once facility in dotnet 2.0.
However instead of writing an application, I thought of writing just an
assembly which I can expose to the COM application through interop. Now
there is just one application to deploy, but it is a COM application. I
don't know how the current application is deployed, but is there *any* way I
can ease the deployment/maintenance burden of that application by using the
click once facility to deploy my assembly, without it being part of a .Net
application?
Thanks for any input
Martin Tag: Switching thread context Tag: 108718
Custom Commands and IMenuCommandService
Hi all,
Can we add custom commands to the implementation of IMenuCommandService
besides those of StandardCommands enumeration ?
Thanks
Ramesh Tag: Switching thread context Tag: 108715
Generic Identity and Integrated Security with SQL
I have setup the following lines of code:
System.AppDomain.CurrentDomain.SetPrincipalPolicy(Security.Principal.PrincipalPolicy.WindowsPrincipal)
mPrincipal = System.Threading.Thread.CurrentPrincipal
mUser = mPrincipal.Identity
' Create generic identity.
mApplicationIdentity = New
Security.Principal.GenericIdentity(controlCenterConfiguration.Employee.Alias)
' Create generic principal.
mApplicationPrincipal = New
Security.Principal.GenericPrincipal(mApplicationIdentity, rolesArray)
'set the thread to run under this new identity
System.Threading.Thread.CurrentPrincipal = mApplicationPrincipal
I am able to use code-based security using this with no problem.
What is not clear to me is how Integrated Security with SQL is still
working. My instinct says it should not work, but it does. I would have
thought my WindowsIdentity would have been replaced by my GenericIdentity and
the thread would not have my windows authentication information.
Will someone explain this to me? Tag: Switching thread context Tag: 108712
Cache Dependencies in Winforms??
Hello
I have a C# application and am caching some data on the client side by
using a HashTable. Is there a way I can set Cache dependencies like a
time factor by which my cache is updated by making a call to the
webservice, as and when the time expires?
I believe on the server side this is done using System.Web.Caching
where you have a number of dependencies to set. Is there something
similar available for the client side? If not does anyone know how it
could be done?
I'd really appreciate if you could reply A.S.A.P.
Thanks,
Vinit Tag: Switching thread context Tag: 108710
SynchronizationContext
Hello
I am trying to raise events in another thread context.
I am using SynchronizationContext object.
It works fine as long as i am synchronizing any thread with the MAIN
PROCESS.
if i try to sync between two independant threads it fails.
somehow the SynchronizationContext.Current property is null.
Any ideas why?
Thanks Tag: Switching thread context Tag: 108707
Windows Installer 3.1(v2) error
When attempting to uninstall Microsoft .NET framework version 1.1, I get
these errors:
(Application popup, event id 26)
Microsoft Visual C++ Runtime Library
Runtime Error
Program C:\Windows\System32\msiexec.exe
This application has requested the runtime to terminate in an unusual way.
Please contact the application support team for more information.
After a long pause, the second error occurs:
The Windows Installer service could not be accessed. This can occur if you
are running in safe mode or if the Windows Installer is not correctly
installed.
I have uninstalled and reinstalled Windows Installer v 3.1 (v2) twice using
both methods described in this article:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q315346
I also tried uninstalling the WI and visiting Windows update where it
automatically downloads and installs the installer. None of this has worked.
I still get both errors.
As I said, this started with trying to uninstall .NET framework1.1. I was
following the method to unistall and reinstall, described in this article.
(I skipped step 4 that required the Msizap utility included in the windows
installer SDK utility) (Did not try the repair method listed here)
http://support.microsoft.com/default.aspx?scid=kb;en-us;824643
The reason for uninstalling .NET framework1.1 is that a critical security
update (KB886903) will not install. Tried countless times even after
sucessfully uninstalling/reinstalling .NET1.1.
Have .NET 1.0, 1.1 and 2.0 installed Tag: Switching thread context Tag: 108706
remoting configuration STA
I am trying to create a remote object that instantiates an ActiveX control.
Apparently ActiveX controls can only be created in STAThreads. When I make
the following call from the client:
_myRemoteObject = (IRemoteObject) Activator.GetObject(
typeof(MyLib.IRemoteObject), host );
I keep getting the following error:
{"Could not instantiate ActiveX control
'd5b7f60a-c223-4556-845d-fe5f59e49f03' because the current thread is not in
a single-threaded apartment." }
I did some searching on the error and people seem to recommend starting
threads as STAThreads. But both my server and client were started as
STAThread. Something is happening when I make the GetObject() call. When I
step into the constructor for my remote object it says that I am in a MTA
thread.
Does anyone know what I am doing wrong? Is there something that I can put
into my remoting configuration file to specify that the remote object should
be created in an STAThread?
-Corey
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =---- Tag: Switching thread context Tag: 108697
.NET programs memory consumption
I noticed that my windows application, very simple test written in C#, keeps
and keeps allocating memory.
For example, when at the start it has allocated 7500kB, after few minutes,
memory allocation is 12000kB. Even if i don't click any buttons or so. And
when i start clicking a button, with no event handling, it allocated 40k more
memory on every click. Is this normal? Why program needs extra memory after a
dummie button click?
I'm using .NET 2.0 and Visual C# Express, on WinXP Home with AMD64. Memory
figures are taken from task manager. Tag: Switching thread context Tag: 108696
Free components
Hi
who can advice me a good web site with free
.NET components, it will be great if there will be cources also
Thank you. Tag: Switching thread context Tag: 108688
User controls
Hi
I am writing (practicing) a small game using user controls
and some time my control whould become over another same type
or another type user or windows control
how can I modify the layout , some thing like Z coordinating in my
controls???
Thank you Tag: Switching thread context Tag: 108687
strong-name - framework 1.1 and framework 2.0
Hi guys,
I have an application that is a asp.net and uses some dlls.
This dlls are signed with a strong-name key.
When I sign a dll using framework 1.1 and a file.snk I get a key XXX.
And when I sign dll using framwork 2.0 and the same file.snk I get a key ZZZ.
(command to get a key from dll: sn -T file.dll)
Why does it happen ? Should I not see the same key ?
TIA,
wrampazo. Tag: Switching thread context Tag: 108686
How to find a block in Finalize()?
Hello,
I'm using .NET Framework 1.1, C#. A couple of days before I've found out
that my application leaks memory not releasing objects with destructors. I'm
using some third-party components (Spring.NET and Oracle Data Provider .NET
(ODP.NET is actually a leak in my case)). I know that it's a good habit to
call Dispose() if the object is IDisposable, but in my case I cannot do this,
and need to rely on destructor (performance loss was considered).
Then I've tried to reproduce the problem in a small test project (with only
ODP.NET objects) and failed :(. The leak was away.
Now I suspect that Spring.NET/ODP.NET somehow blocks the finalizer thread,
so that it never clears the garbage left.
Justification:
/// <summary>
/// Create a new session
/// </summary>
/// <returns>The new session that can be used by the client.</returns>
public ISession CreateSession()
{
GC.Collect();
GC.WaitForPendingFinalizers(); //Application hangs here
GC.Collect();
GC.WaitForPendingFinalizers();
new Message(Message.MessageType.CalledCreateSessionOn0,
this.GetType().FullName).LogDebug();
ISession session = (ISession)
Application.CreateSession()[typeof(ISession).FullName+".Remote"];
return session;
}
This method will be called relatively early after the client starts (server
and client interact over normal MarshalByRef objects, there is anyway not
much interaction there...). It is practically the first client call on the
server side. Before the first client starts there will be some Spring.NET
initialization done and an OracleConnection opened and closed (to check that
the database is available).
The problem is that this code hangs on the first call to
GC.WaitForPendingFinalizers(). By "hangs" I mean that nothing else will be
done in application - no log messages, in Visual Studio I can pause/stop
application (shows me a Console.ReadLine(); line - is not relevant). I've
been waiting for 15 minutes - no changes. The memory leak was found out by
ANTS Profiler and is definitely there. :(
I've also installed WinDBG in order to find out where the finalizing thread
is blocked, but had not much advance on that field (starting from that I do
not know which of threads is finalizing thread).
I have source code for Spring.NET, but it is really huge and not quite
understandable. I would be happy if I'll find out that the problem is really
in Spring. Can anyone help me, please? Do I actually force the garbage
collector in a correct manner (Collect/WaitForFinalizers,
Collect/WaitForFinalizers)? How can I find out what the finalizing thread is
actually doing? Does the observed behaviour (hang on
WaitForPendingFinalizers) actually an evidence that there are problems in
finalizer?
Thank you in advance. Tag: Switching thread context Tag: 108685
problem with special characters in password
We have a case where users who are encouraged to have good passwords with
norwegian characters and other special characters cannot login to a ASP.NET
1.0 app.
This problem is discussed in the following article from MSKB:
http://www.kbalertz.com/kb_835388.aspx
Do you know if this problem is fixed in later versions of the framework?
I.e. servicepacks, 1.1 or 2.0.
Thanks.
--
_________________
Rolf @ Questus ans Tag: Switching thread context Tag: 108684
Exception from dialog not catched on Windows x64 box?
Hello.
I've installed VS 2003 on my Windows XP x64 box. And catched the
problem: if exception is thrown from some window ShowDialog it is not
catched by catch followed by ShowDialog.
Somewhere in the VisibleChanged dialog form handler exception is
thrown.
private void Dialog_VisibleChanged(object sender, System.EventArgs e)
{
if (Visible == false)
throw new ApplicationException("test exception from dialog");
}
On Windows XP x32 box it is catched after dialog is displayed.
try
{
using (Dialog d = new Dialog())
{
d.ShowDialog();
}
}
catch(Exception ex)
{
MessageBox.Show(string.Format("exception catched\r\n{0}",
ex.Message));
}
When code is build on Windows XP x64 exception is not catched :( How it
could be possible?
Compleete test could be downloaded from
<http://spot9969.multiply.com/video/item/1> (11KB, VS 2003) Tag: Switching thread context Tag: 108683
Detect the encoding of a stream
Hi,
Is there a way in which I can detect the encoding used while creating a
StreamReader? I have a method which receives a StreamReader as a
parameter. I want to ensure that when I do a
StreamReader.BaseStream.Seek() , I give the appropriate offset so that
encoding information/byte order marks are not read in (In case the file
uses UTF8 or Unicode encoding). Is there a standard way to do that?
Thanks,
Roshan Tag: Switching thread context Tag: 108678
Free tool to compress and pack .NET assemblies (embed DLLs is single EXE )
.NETZ is a free open source tool to compress .NET EXE and DLL files,
writen in C#. It can also pack the DLL files with the EXE, creating a
single EXE file:
http://madebits.com/netz/index.php Tag: Switching thread context Tag: 108676
CPU load of process started from .Net Process class is low
Hello,
is here anybody who can tell me why process started with Process class
has less CPU time that same process started from command line? Most
strange thing is that when I use Process class to start batch file,
which starts that process, it works faster.
BR Tag: Switching thread context Tag: 108674
Smart Client Problem
Hi,
I have developed C# Windows application. I thought of deploying this
application in the webserver and access the application like SmartCLient
model.
I have given IIS permissions. I have written small application which will
access the main application using URL.
I am gettin the login screen of the main application, entered the user name
and password, clicked on teh OK, when i click on OK, it will check the
app.config file and will connect to the database and will get the MDI screen
to Client PC. Here i am getting the Exception. I am unable to catch this
exception also. WHen i write MessageBox.Show, it is not displaying the
exception, please help me in this.
Thanks in advance
Satish Tag: Switching thread context Tag: 108673
Using TcpClient with Modem
Hi everybody,
I am still learning how sockets, TcpClient and TcpListener work, in order
that both sides to send and receive data, both sides must have a socket or
TcpListener and a TcpListener right? Is there a possible way to say just have
a client side TcpClient application to send a message to remote server like
sending a text file?
Do TcpClient requires a Internet connection to connect say to remote
server? So, to connect to a VPN network(remote server), I need to establish
internet connection like using RAS. Right? How do you programatically create
connection using a local USB port with a GPRS modem? Using Sockets or
TCPClient will be enough to do that? Please provide me with info on these
questions.
Is there anybody knows how to do this? Thanks.
den2005
--
MCP Year 2005, Philippines Tag: Switching thread context Tag: 108671
MSN chat integration
i dont want to have my own chat application but instead integrate msn chat
with my application, are there any API exposed for it??? Tag: Switching thread context Tag: 108668
Why Assembly.LoadWithPartialName is obsolete?
Hello,
Does anybody know why the "Assembly.LoadWithPartialName" is obsolete?
It seems that the Load method does not have an equivalent replacement for
it.
--
Best Regards,
W. Jordan Tag: Switching thread context Tag: 108659
framework for linux????
Hi all,
Is there a framework for linux?
Is it possible to run a .net application on a linux platform?
thank you very much
mi... Tag: Switching thread context Tag: 108655
testing a program is running
I'm writing my installer which, of course, is a win32 app (no .NET)
I would like to test tthe program is already running (in case of
reinstall/upgrade) and prompt the user to stop the application.
How do I do that?
Basically I would like somthing like Process.GetProcessByName() but with
win32 calls.
Any idea? Tag: Switching thread context Tag: 108654
WaitCursor / hourglass in custom printpreview dialog
Hi,
I have created a simple custom PrintPreviewDialog consisting of a simple
standard PrintPreviewControl (.NET 1.1) on a WindowsForm with a few buttons
(for printing, zooming, etc.). It is working fine, except for that I cannot
figure out how display the waitcursor / hourglass while the preview is
preparing to show the document *and then go back to the default cursor when
the document is displayed*. Turning on the waitcursor is easy, but what
event should I hook into to turn it off??
What happens when I preview a document that is about 50 pages long is that
you get the blank form on the screen and then nothing happens for maybe 40
seconds and then you get a "Generating Preview" message and then the
document is displayed. It is during the initial 40 seconds that I need an
hourglass or something to let the users know that something is happening in
the background.
Here are some snippets of what I am doing currently:
// Constructor:
public PreviewDialog(System.Drawing.Printing.PrintDocument printDocument,
int zoom)
{
InitializeComponent();
_printDocument = printDocument;
_zoom = zoom;
}
private void PreviewDialog_Load(object sender, System.EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
Initialize();
//this.Cursor = Cursors.Default; // This gets hit instantly, so you
never see an hourglass.
}
private void Initialize()
{
uxPrintPreview.Anchor = AnchorStyles.Bottom | AnchorStyles.Top |
AnchorStyles.Left | AnchorStyles.Right;
uxPrintPreview.Zoom = zoom;
this.WindowState = FormWindowState.Maximized;
uxPrintPreview.Document = printDocument1 = printDocument;
}
// The calling code:
using (PreviewDialog form = new PreviewDialog(c1Report1.Document))
{
form.ShowDialog(this);
}
If there was an event like LastPageFinished or DocumentRendered or similar
in the PrintPreviewControl, I would be home free, but I cannot find anything
like that.
Any help on this would be greatly appreciated.
Thanks,
Lars Tag: Switching thread context Tag: 108648
Work Flow
Hi All,
Is there any open source code available for workflow engine in C#, VB .Net
framework.
Regards
- Atul Sureka Tag: Switching thread context Tag: 108647
How to store objects created with C# in database in .NET Framework
I want to store the objects that i create in run time in database. In a way
that, for a product a create an object from a class written with C#, define
its properties and functions that it has, and want to store it in a database
(SQL Server 2K). I want the columns to be created and filled dynamically when
an object is inserted in db (Just like in J2EE, which is called i think
relational mapping, or something like this).
How can I do that? Tag: Switching thread context Tag: 108641
How to store C# objects in DB
I want to store objects that i create programmatically in C#, like in J2EE
(which is callad i think relational mapping or sometihng like this). I want
to create objects that i use for my enterprise applications and store them in
database after execution. And I want the columns and rows related to my
objects to be created and filled automatically.
How can i do that. Thanks? Tag: Switching thread context Tag: 108640
executable digital signature
how do i add to my executable assembly (created using VB.NET / C#) a digital
signature? Tag: Switching thread context Tag: 108638
.NET Remoting to COM
Hello,
I have a .NET application where I want to be able to access COM objects on a
remote server (theses objects are the base for a web appliation we are
running).
I've been looking on the net for an easy example, or at the very least some
documentation that would make tell me how to do it (if at all possible). So
if anyone has any idea on how this could (or coudn't) be done, or any cue on
where to look and for what, I would strongly appreciate.
Many thank's in advance.
Eric Tag: Switching thread context Tag: 108637
installed 2.0.50727 now I get a sql express error message
I now get the following error message after copying an asp.net application to
the deployment web server. I don't have SQLExpress or any version of SQL
2005 installed. I found the "LocalSQLServer" connection string in the
machine.config, changed that to look at a SQL 2000 database, but the error
still comes up.
An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)
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.Data.SqlClient.SqlException: An error has occurred
while establishing a connection to the server. When connecting to SQL Server
2005, this failure may be caused by the fact that under the default settings
SQL Server does not allow remote connections. (provider: Named Pipes
Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): An error has occurred while establishing a
connection to the server. When connecting to SQL Server 2005, this failure
may be caused by the fact that under the default settings SQL Server does not
allow remote connections. (provider: Named Pipes Provider, error: 40 - Could
not open a connection to SQL Server)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) +734995
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +188
System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner,
Boolean& failoverDemandDone, String host, String failoverPartner, String
protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean
encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection
owningObject, Boolean aliasLookup) +820
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String newPassword,
Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningConnection) +359
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32
startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
+162
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +107
TIA,
Dave Tag: Switching thread context Tag: 108636
mscorsvw x64 OS freeze When Idle
Hello,
I am running XP64 SP 1. I had VS2003 installed. When I tried to install
VS2005 professional my machine froze on the framework 2.0 install. I
rebooted and tried again. Same thing. I disabled my Antivirus and tried
again. Froze on the same spot.
I uninstalled VS2003 and framework 1.1, disabled my Antivirus and tried to
install framework 2.0 from the MS update website. The system froze. Once
rebooted, "Add or Remove Programs" showed that the install was complete. I
rebooted, disabled my Antivirus and then tried to install VS 2005. It
worked.
Unfortunately every time I leave my system idle for 5 to 10 minutes it
freezes up again. I opened my task manager and let it idle and every time it
freezes mscorsvw.exe is on the top of the CPU order. I did some research
and found this article.
http://blogs.msdn.com/davidnotario/archive/2005/04/27/412838.aspx
I tried the:
ngen.exe executequeueditems
It ran, reported some errors that I missed durning the scroll by and then
locked up. I have tried it again and it locks up each time at:
Executing
C:\windows\microsoft.net\framework\v2.0.0.0,culture=neutral,publictoken=b77a5c561934eo8911 /nodependencies /nologo
Least that the way I read my bad hand writing.
Any ideas on how to fix it?
Thanks in advance
Mark Tag: Switching thread context Tag: 108634
upgrading to .NET 2.0 woes
hello ,
I'm upgrading c++ files in which the source is available that has a
managed wrapper to a non-managed dll. It was .NET 1.1 now I want .NET
2.0
I made some changes and I now get some warnings when compiling. I get
no errors.
Running this dll from my C# app returns the following exception:
{"Strong name validation failed. (Exception from HRESULT: 0x8013141A)"}
referring to the data:
{System.Collections.ListDictionaryInternal}
Now as far as I know .NET 2.0 does not contain
"System.Collections.ListDictionaryInternal". I'de like to fix my c++
file to point to the new
"System.Collections.Specialized.ListDictionary" but I can't even find
where it is trying to do this :( Searching the project for
"ListDictionary" did not return anything.
Any hints?
V. (c++ ultra-noob) Tag: Switching thread context Tag: 108631
assembly name or one of its dependencies was not found
Hey Everyone,
I have run into a problem with asp.net
I have a web page default.aspx that posts to itself. On post, I call a
WebService to validate uername and password.
In the catch block of the WebSerive call, I am getting the attached
error. I have been researching this error for about two days and have
tried adding the ASP.NET and NETWORK SERVICE users to the administrator
group with full permissions over C:\WINDOWS and it's children as most
of the research I did pointed to that issue.
I have also installed the XMLPrecompiler solution to see if there are
any issues with serialization, but everything checks out fin there as
well.
Lastly, I verified that I was running .NET 1.1.X as some research said
that may be an issue as well. I would appreicate any help or any
suggestions.
-MW
ERROR TEXT:
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
CUSTOM METHOD DECLARATION
System.Web.Services.Protocols.SoapException: Server was unable to
process request. --> File or assembly name oaayvpwc.dll, or one of its
dependencies, was not found. at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
CUSTOM METHOD DECLARATION
Server was unable to process request. --> File or assembly name
oaayvpwc.dll, or one of its dependencies, was not found. Tag: Switching thread context Tag: 108630
Refreshing TreeView after Editing a Label
Here's the problem. I have a TreeView that is essentially a listing of
directories and files. If you right-click on a directory then a
context menu comes up and one of the options is "New Folder", when the
user clicks that it expands the current node, creates and add's a child
node, then calls BeginEdit() on the child node.
I have written a custom class that implements IComparer to sort on
rules that I have defined. The problem comes in the fact that
BeginEdit() appears to be an async call, and as far as I can tell,
there's no event that gets fired to let me know when it is done so that
I can then call Sort() on the TreeView. There is an 'AfterLabelEdit'
event on the TreeView, but it appears that the actual label on the node
isn't changed until after that event is finished firing. I've tried
manually setting the text of the node in an event handler for that
event, but it causes the TreeView to do wierd things (like the node is
still editable after I finished editing it, and if this is the second
or so folder I've created, the previous one I create is being
reassigned the same name as the one I created. If anyone can help me,
I'd appreciate it.
Code:
================================================
private void contextMenuFolder_Click(object sender, EventArgs e)
{
TreeNode newFolder = new TreeNode("", FOLDER_CLOSED,
FOLDER_OPEN);
tvwReports.SelectedNode.Nodes.Add(newFolder);
tvwReports.SelectedNode.Expand();
CatalogItem item = new CatalogItem();
item.Type = ItemTypeEnum.Folder;
newFolder.Tag = item;
newFolder.BeginEdit();
}
private void tvwReports_BeforeLabelEdit(object sender,
NodeLabelEditEventArgs e)
{
if (e.Node.Tag != null)
{
if ((e.Node.Tag as CatalogItem).Type !=
ItemTypeEnum.Folder)
e.CancelEdit = true;
else
e.CancelEdit = false;
}
else
e.CancelEdit = true;
}
private void tvwReports_AfterLabelEdit(object sender,
NodeLabelEditEventArgs e)
{
this.Cursor = Cursors.WaitCursor;
string fullPath =
e.Node.FullPath.Substring(e.Node.FullPath.IndexOf('/'));
if ((e.Node.Tag as CatalogItem).Name == null)
{
if (e.Label == null || e.Label == "")
//this is a new folder and no name was given,
delete the node
e.Node.Remove();
else
{
//get path as relative to the webservice
fullPath += e.Label;
//new folder node, need to call webservice to add
CatalogItemManagement.CatalogItemManager.AddFolder(fullPath);
e.Node.Tag =
CatalogItemManagement.CatalogItemManager.GetCatalogItem(fullPath);
}
}
else if ((e.Node.Tag as CatalogItem).Name != e.Label)
{
if (e.Label == null || e.Label == "")
//the label was left blank, set it back to what it
was before
e.CancelEdit = true;
else
{
//node already existed, but folder name has
changed, need to update
CatalogItemManagement.CatalogItemManager.MoveCatalogItem(fullPath,
fullPath.Replace(e.Node.Text, e.Label));
}
}
this.Cursor = Cursors.Default;
}
================================================
I am using Visual Studio 2005 (with .NET 2.0, of course) Tag: Switching thread context Tag: 108620
Nullable<int>, implementing GetHashCode, and thread safety
The VS2005 documentation for Object.GetHashCode has three notes to
implementors:
*blockquote*
If two objects of the same type represent the same value, the hash function
must return the same constant value for either object.
For the best performance, a hash function must generate a random
distribution for all input.
The hash function must return exactly the same value regardless of any
changes that are made to the object.
*/blockquote*
So in a reference type that isn't immutable satisfying the third requirement
seems to require caching the hash code the first time it's queried for. This
seems like a good place for Nullable<int>.
However, if there's a competing requirement for the reference type to be
thread-safe, the cached hash code needs to be initially assigned in a thread
safe manner. To avoid the thread safety problems with double checked locking,
there will be a locking cost associated with initially creating and caching
the hash code. To minimize the cost, and since the hash code will be
int-sized, it'd be nice to take advantage of the System.Threading.Interlocked
class's methods.
Hmm, but Interlocked.CompareExchange can't handle the following:
Nullable<int> alpha = null;
int value = 1;
Interlocked.CompareExchange(alpha,value,null);
Rats. The nullable type would have seemed cleaner, but boxing an int into an
object (below) still works.
Is this the best way to go?
How bad would the overhead of locking a private instance field and using a
nullable type be by comparison?
Is there something obvious with Nullable<int> that I'm missing that would
support this?
Should Interlocked get overrides to handle Nullable<T>?
Could such overrides avoid the same overhead that locking a private instance
field would face?
class Triple<T1, T2, T3>
{
private Object hashCode;
private T1 first;
private T2 second;
private T3 third;
//...
public override int GetHashCode(){
if (this.hashCode == null){
int firstHash = (!Object.ReferenceEquals(this.first,null)) ?
this.first.GetHashCode() : 0;
int secondHash = (!Object.ReferenceEquals(this.second,null)) ?
this.second.GetHashCode() : 0;
int thirdHash = (!Object.ReferenceEquals(this.third,null)) ?
this.third.GetHashCode() : 0;
Interlocked.CompareExchange(ref this.hashCode,
(Object)(firstHash ^ secondHash ^ thirdHash), null);
}
return (int) this.hashCode;
}
//...
} Tag: Switching thread context Tag: 108617
Embed windows media player and possibly others in .net app?
I have a list of media files to choose from in the app. Right now
clicking on it will launch it using System.Diagnostics.Process.Start to
launch whatever appropriate application for that particular file. Since
I know the extension of the file, can I embed media player in the app
instead of having media player popped up and run separately, just like
embedding the media player in the web page with certain functionality
show? Tag: Switching thread context Tag: 108615
How to add right click menu
Tool: Visual Studio 2005
I have a custom photo library application previously written in VS 6.
Basically it has
1) DriveListBox, DirListBox, FileListBox, all listed as
Microsof.VisualBasic.Compatibility.xxx
2) PictureBox inside a Panel (for auto showing scroll bars when photo
exceeds viewable area).
3) Buttons under FileListBox to Rename, Delete, etc file.
I'm thinking there must be something equivalent to Explorer that allows
you to single click to rename, right click with a bunch of options
(Rename, Delete, Cut, Paste, etc) that I can replace the FileListBox
with. If not, then I'd like to make it so that right click on a
selected file would prompt a context menu with a few basic options.
Thanks. Tag: Switching thread context Tag: 108608
setting envrionment variable in C# and access it within native C++
We are having difficulties getting environment variable within native DLL
written in C++ which is loaded by C# .NET assembly, the env var is set by the
.NET assembly.
We have an existing C++ application, and want to access it within C#. So we
wrote Managed C++ wrapper which access the native C++ DLL. The Managed C++
wrapper is compiled as .NET assembly that C# can access.
The native C++ DLL need to have an environment variable set to work
properly. So within the C#, we use:
[DllImport("Kernel32.dll")]
public static extern int SetEnvironmentVariable( string name , string
value );
to set the env var.
But within the native C++ DLL, it will fail when trying to do "getenv()",
with error:
Object reference not set to an instance of an object.
1. If we make the C# application as console application and set env var in
the console before start the C# application, it works. But we can't make the
C# app a console app.
2. If we execute within the C# application a .bat file which prints out the
env var, it shows that the env var is set.
Looks that the native C++ DLL can't getenv() on the env var set within the
C# app.
Any solutions for this?
Thanks a lot. Tag: Switching thread context Tag: 108605
programmatic to ftp virtual directories
programmatic to ftp virtual directories
when i connect to an ftp server and i only have access to a few of the ftp
virtual directories, do i just change directory to them after connecting and
having credentials authorized? is there some special protocol for changing
directories to authorized virtiual directories? Tag: Switching thread context Tag: 108604
programmatic to ftp virtual directories
programmatic to ftp virtual directories
when i connect to an ftp server and i only have access to a few of the ftp
virtual directories, do i just change directory to them after connecting and
having credentials authorized? is there some special protocol for changing
directories to authorized virtiual directories? Tag: Switching thread context Tag: 108603
ASP Windows Service or Console based application
Hi all,
I am confused as to what kind of application to develop. I have to create an
application thats like a "Engine" which continously monitors a DB or
whatever. It has to work even if the user logoff as this engine feeds some
other application.
I tried creating a Windows service that runs continously but the status
shows "Starting" and i cant "Stop" or "Pause" and was suggested by one
BravesCharm that "Status does not change as the service never notifies the
SCM that everything started OK" which makes sense.
Is there a way for windows service to start some other application? is yes
then how can i stop it from this windows service?
Please do give me suggestions on how to achieve this.
Thanks,
Stephen Tag: Switching thread context Tag: 108601
Clickonce install from CD
Hi,
I generated the deployment files into a local directory with specified
installation URL.
My prolbems:
- If there is an internet connection on the client machine, it skips the
files on the local hard drive, immediately start downloading from the web.
- if there is no internet connection, the setup.exe fails (which is the
startup program from a CD), but the application icon installs the software
well.
I implemented a custom async update. When I call the CheckUpdateAsync method
I have got an exception in the Application.ThreadException event, not in the
AsyncCompleted event as the MSDN says (in the e.Error)...
Why?
Thanks.
lelez
------------
Here it is the code:
try
{
ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted += checkHandler;
dep.CheckForUpdateAsync();
}
catch (System.Net.WebException)
{
// never runs!
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
}
catch (Exception ex)
{
xxxx.Common.Util.Logger.LogException(ex);
}
Here it is the handler:
private static void dep_CheckCompleted(object sender,
CheckForUpdateCompletedEventArgs e)
{
if (e.Error is System.Net.WebException)
{
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
return;
}
ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted -= checkHandler;
try
{
if (e.UpdateAvailable)
{
ContinueQuestionEventArgs ce = new
ContinueQuestionEventArgs(e.AvailableVersion.ToString());
// Ask the user about continue...
if (updateIsAvailable != null)
updateIsAvailable(null, ce);
if (ce.Continue)
{
dep.UpdateCompleted += updateHandler;
dep.UpdateAsync();
}
}
}
catch(InvalidOperationException ex)
{
xxxxx.Common.Util.Logger.LogException(ex);
}
} // dep_CheckCompleted...
--
-----------------------------------
http://www.lelez.hu
ICQ: 177465172 Tag: Switching thread context Tag: 108600
Caching architecture question.
I am thinking about using Caching application block in my web
application, for the performance reasons.
My ideal sitiuation would be if i could plug in the application block
between my Persistence layer and database, so that objects are created
from the cache and cost of CRUd operation can be avoided....
the problem each object is not having a unique key, and caching
application block does not provides any typed cache functionality, for
example if i store a product object wtih uid 1 and a customer object
with uid 1 then it would overwrite the product object,
Iam thinking about creating a multiple cache managers according to the
type of object, and keep all those cache managers in a super cache...
in that case would the scavenger clean up caches inside a cachemanager
object ?
any comments Tag: Switching thread context Tag: 108595
Hi
i am interested to know how can i switch thread context in code.
meaning execute some code in desired thread context.