Writing to the EventLog in Vista
Is it possible to write an entry in the "Windows Logs\Application" EventLog
and set the source to the name of our application, without creating a source
for our application ?
If we set source to "Application" when calling the WriteEntry method on the
EventLog class, the Source name for the entry will be "Application".
Best regards
Henrik Skak Pedersen Tag: could not find schema information policyinjection Tag: 131853
Blocking on NetworkStream.Read()
Hi
I've recently written a .NET client which communicated to a server via a
TcpClient class (from System.Net.Sockets).
One thing I noticed is my call to the GetStream().Read() method is not
blocking.
I've been through a few different sections in the MSDN help as well as a few
books and articles about the TcpClient class and have gotten some conflicting
information.
The information on the ReceiveTimeout property states it will set the
blocking on the NetworkStream.Read() method.
The documention on the NetworkStream.Read() method give the impression that
a call is non-block since it doesn't wait for data to become available before
returning.
I've looked at a number of samples of using the TcpClient class at various
sites and all appear to be written as if the Read method will block.
Does anyone know if there are specific conditions which may be affecting
this behaviour (i.e. additional properties or server / network factors)?
Thanks in advance
Al Tag: could not find schema information policyinjection Tag: 131847
Microsoft Update for Dot Net Framework 1.1 and 2.0 fail. Help please
Hi!
My notebook PC has Microsoft.Net 3.0 installed on top of 2.0 and 1.1 (as an
upgrade).
Today I saw two security update for 2.0 and 1.1 service pack 1 show on
Windows Update critical list.
So I downloaded and install them. Both installation fail. Why? Can some
friend and expert here help please!
Do I need to install them, and how? What are the problems I experienced?
These are the two updates that failed to install
.NET Framework 1.1 Service Pack 1 SYSTEM.WEB.DLL and MSCOREE.DLL Security
Update for Windows 2000, Windows XP,Windows 2003 x64/IA64
.NET Framework 2.0 SYSTEM.WEB.DLL and MSCOREE.DLL Security Update for
Windows 2000, Windows Server 2003 and Windows XP
Regards
Sanchai T.
Bangkok, Thailand Tag: could not find schema information policyinjection Tag: 131846
Using modem in c#
I am currently working on an application in c# that doesn't trust the
internet for its communication. Our company needs this software to connect
to another computer through modem and then send and receive data. Any
suggestion or helpful tutorials for this in c# ?
Thanks for any help! Tag: could not find schema information policyinjection Tag: 131837
Help IIS Identity Crisis
I have a web application (.Net 2.0, IIS 6 Windows 2003) that uses an
unprivileged user as the identity for the application pool. IIS
requires the user have the "log on as a batch job" right. My web
application calls a WCF MSMQ service and uses a certificate for
authentication (not encryption as this is a workgroup server).
Unfortunately, the application cannot find the certificate and throws
an exception. I believe this to be because IIS is doing a "log on as a
batch job" and the user's certificate store is not available. As soon
as I open a command shell "runas" the user, the user's profile is
loaded, the certificate store is available and I can successfully send
an authenticated request to my WCF service.
I'm happy I finally managed to establish why this was working
sporadically:
Step 1 - send request to web service; fails because can't find
certificate
Step 2 - open MMC "runas" IIS application pool identity to check
certificate exists
Step 3 - yep, it's there alright
Step 4 - oh, now my application works, WTF
Is there some way to require IIS to load the application pool identity
profile? Tag: could not find schema information policyinjection Tag: 131816
MVC Framework
Hello all,
I've been searching for a video I found a while back which showed a
MVC style framework which was used to seperate the business logic from
the UI. This made it possible to use the exact same logic in both
asp.net and WPF. I had thought that this was a video showing Microsoft
developers showing off the technology but now I'm not sure as I can't
find the video again. I would really like to know if anyone knows what
this framework was or where this video is as I have spent many hours
now trying to find it again. The only details of it that I can
remember is that it was an MVC style framework and that the example in
the video was using asp.net. I also remember there being View and
Controller interfaces used along with it. Tag: could not find schema information policyinjection Tag: 131806
Thread safety of events
Hi,
I have an object O1 that executes code in thread T1. O1 raises events.
There is an object O2 that runs in thread T2. O2 catches O1's events.
Question:
What happens if O2 is detaching the event handler at the same time as O1
is raising the event? Do I have to handle this special situation explicitly?
Honestly I haven't read/heard that anybody ever cared about this. It would
be pretty much work to do because every event handling object would have to
prevent the event raiser from raising the event while detaching it's own
handlers. Not a good OO way also. I know the "instance members are not
thread safe" part of the Delegate/Multicastdelegate documentation, but I
also think that Events are a basic element in the runtime's infrastructure,
so maybe I don't have to handle the situation explicitly?
Armin Tag: could not find schema information policyinjection Tag: 131797
Maintain list of attached event handlers (.Net 1.1)
Hi,
here's the short version:
How can I remember which event handlers did I attach to which events?
Background:
- I have an object tree. There is one root object, containing sub objects,
containing sub objects, and so on. All the objects in the tree can raise
events.
- In a Form's Load event, I recursively process the object tree and attach
event handlers to all the events of the objects in the tree.
- Whenever an event fires, I detach the event handler. (because it won't
fire twice)
- When the Form closes, maybe not all events have been fired. Therefore,
there are still event handlers attached to these events.
My goal is:
I must detach the remaining event handlers when closing the Form.
Question:
How do I know which event handlers are still attached? I thought I simply
could maintain a list of attached event handlers. Whenever an event fires,
I detach the event handler and remove the corresponding entry from the
list. So, if the Form closes, I only have to process the list in order to
detach the remaining handlers.
But, /what/ do I have to store in the list? I didn't find a way without
using Reflection.
Thanks for reading!
Armin Tag: could not find schema information policyinjection Tag: 131789
Do Not Show Property?
I have a public property with this attribute decorating it:
[System.Xml.Serialization.SoapIgnoreAttribute]
but when I convert an object to XML (it inherits from
System.Data.DataTable), it still shows as a Property in the raw XML.
Why does it do this and how can I make it stop? I don't want any
properties to exist in the XML, just the rows from the DataTable.
Thanks. Tag: could not find schema information policyinjection Tag: 131787
Running out of Sockets
I am working on a .Net Web Service which will be used by thousands of users
at a time. It does lot of file operations (Creating, deleting, enumerating,
reading attributes etc) and Ldap queries to AD using .Net APIs. Under stress
test, service machine runs out of Sockets and we start seeing weird errors. I
created MaxUserPort entry in registry on service machine toa llow 65,500 max
no. of sockets to be created. It runs fine now. It could be a problem later
during more stress in production. Is there a way in .Net to minimize socket
usage during file and ldap AD operations? Is there a way i can force the
machine to recycle the sockets so it never runs out of socket.
Thanks,
Salim Ansari Tag: could not find schema information policyinjection Tag: 131781
Perfect Singleton with Semaphore?
Can anyone show a code sample of a "perfect Singleton" that uses the
Semaphore class in Framework 2.0? I have a security-related class that
I would like to code as a Singleton, and re-use it in both ASP.NET and
WinForms. I understand that these are very differnet environments when
it comes to threading and etc, so any/all help is appreciated.
Thanks. Tag: could not find schema information policyinjection Tag: 131780
Remoting: Number of server activated objects
Hi,
for a license model I need to count the objects that are activated at the
server.
The class at the server is registered with:
RemotingConfiguration.RegisterActivatedServiceType(GetType(Class1))
I need the number of objects of Class1 that are activated at the server?
Is this possible?
Thanks Tag: could not find schema information policyinjection Tag: 131778
RS232: How to set rts=tg and xon=off
I'm developing an interface application for existing multiport direct connect
modem ports (RS232) that require setting rts=tg (toggle) while keeping
xon=off. The environment is VB in VS2005. I would like to use the
System.IO.Ports.SerialPort class but the only handshaking I see that comes
close is Handshake.RequestToSendXOnXOff (3) and that uses xon=on. The
RtsEnable is a boolean that represents on|off. Rts is actually 2 bits and
can be set to [on|off|hs|tg]. Am I totally missing something or do I have to
fall back to the Win32 API? Tag: could not find schema information policyinjection Tag: 131774
XML Serialization at Design Time
I'm still using XML Serialization at Disign Time.
All the deserialized objects forgiveness their attributes like
[Browsable(false)]
How can I restore attributes into Deserialized object??
I'm using Visual Studio SP1 with Framework 2.0
Thanks Tag: could not find schema information policyinjection Tag: 131772
XML Serialization Design Time
I'm still using XML Serialization during Design Time.
All the deserialized objects forgiveness their attributes like
[Browsable(true)]
How can i restore attributes into deserialized object??
I'm using Visual Studio 2005 SP1 and Framework 2.0.
Best Regards Tag: could not find schema information policyinjection Tag: 131771
DateTime.ParseExact mit Wildcards
Hallo,
gibt es mit DateTime.ParseExact eine Möglichkeit Wildcards zu verwenden?
Beispiel:
"20071007abcd123100" soll geparst werden, wobei "abcd" beliebige andere
4 Zeichen seien können.
Ich denke also an so etwas wie:
DateTime.ParseExact("20071007abcd123100", "yyyyMMdd????HHmmss", null);
Hat da jemand eine Idee?
danke & ciao
Torsten Tag: could not find schema information policyinjection Tag: 131758
Temporary Files And Permissions
Hello,
I have been struggling quite a bit with a problem that cannot possibly
be this difficult to get past.
The full scenario, is that I want to get a file from our Visual
SourceSafe database, run a parser on it (translates an SQL dialect)
and check it into another location.
Now the SourceSafe and translation bit of all this works like a charm,
but handling the temp files don't. The basic structure (first cut)
looks like this:
private void button3_Click(object sender, EventArgs e)
{
IVSSItem itemSybase = dataBase.get_VSSItem(comboSybasePath.Text,
false);
IVSSItem itemSQL = dataBase.get_VSSItem(comboSQLPath.Text, false);
string pathSybase = Path.GetTempFileName();
string pathSQL = Path.GetTempFileName();
FileInfo fileSybase = new FileInfo(pathSybase);
FileInfo fileSQL = new FileInfo(pathSQL);
try
{
itemSybase.Get(ref pathSybase,
(int)(VSSFlags.VSSFLAG_REPREPLACE |
VSSFlags.VSSFLAG_FORCEDIRYES));
itemSQL.Checkout("Automatic conversion from Sybase", pathSQL,
(int)(VSSFlags.VSSFLAG_REPREPLACE |
VSSFlags.VSSFLAG_FORCEDIRYES));
try
{
ConvertStoredProc(fileSybase, fileSQL);
itemSQL.Checkin("Automatic conversion from Sybase",
pathSQL, 0);
}
catch
{
itemSQL.UndoCheckout(pathSQL, 0);
throw;
}
}
finally
{
fileSybase.Delete();
fileSQL.Delete();
}
}
Essentially, I get the temp file names with Path.GetTempFileName() and
let SourceSafe overwrite the first file. I then use FileInfo objects
to process the source text, write the destination file and finally
delete both files once the destination file has been checked into
SourceSafe.
What perplexes me no end, is the fact that I can create the temporary
files without a hitch, but deleting them again causes a
SecurityException to be thrown. Why can I not delete a file that I was
able to create?
I then tried to specify FileIOPermission on my application, but the
same is then used on the imported assembly for SourceSafe. And since I
don't actually want to access anything other than the temp folder, I
really want to specify Path.GetTempPath() as the path to get
permission to - where do I do that?
Finally, I thought I would use isolated storage, but again ran into
trouble. Unless I missed it somehow, you cannot actually get the name
of the file path you are working with - which means that I cannot
specify that path for SourceSafe to use!
Right now, it almost seems like the most reliable way of doing this
will be to simply leave the temp files, but that is messy.
Any ideas?
Cobus Kruger Tag: could not find schema information policyinjection Tag: 131756
Using different configurations (web.config, app.config)
Hello there,
is there a possibility to use different configurations for debug and
release mode?
I need other settings in debug mode than in release mode but do not
want to replace the web.config all the time manually.
Regards,
Norbert Tag: could not find schema information policyinjection Tag: 131754
Question about return 0 in Socket::EndSend in C#
I have written a program that is using Async Socket,
And the program will send a lot of packet to the socket, and i used
BeginSend and EndSend for sending the data.
But the werid thing is that, sometime, the EndSend return 0, so it
implies that 0 byte of data have been sent, so the my program will try
to do the BeginSend again and try to send the data again, but the
result is that the other side will receive 2 same packets. So what is
wrong with it?
Thanks Tag: could not find schema information policyinjection Tag: 131750
save web page as ppt
hi i need to allow a user to save a web page as a ppt file. i built the site.
this site shows a schematic of a vehicle. i want to put a button on the page
that will allow the user to save the page as a power point slide. Tag: could not find schema information policyinjection Tag: 131743
Great new development community concept
I found this new site I am excited about http://www.spikesolutions.net.
The concept, zip up your programming solutions and submit them to this
site for free. Each time someone downloads your solution you get
$1.00. The creators of the site are trying to improve the quality and
availability of "spike solutions" by rewarding developers with cash
for submitting their solutions. I would like to hear your thoughts. Tag: could not find schema information policyinjection Tag: 131741
Can ternary conditional expressions be represented in the CodeDOM?
... I know I could use a CodeSnippetExpression to do it, but that would
somewhat hardcode the resulting tree. I was looking for something like:
CodeTernaryExpression(
CodeExpression test,
CodeExpression trueExpression,
CodeExpression falseExpression);
Which would, of course, get turned into the corresponding:
(test ? trueExpression : falseExpression)
expression in C#, C++, or even J# (I believe). I guess it's only VB.NET
that doesn't have a ternary expression but I don't know for sure.
I know, I know, for generated code there's no real reason to use a ternary
expression, but coding habits are hard to break, even when writing meta-code
:-)
Regards,
-- TB Tag: could not find schema information policyinjection Tag: 131740
A list of people in an active directory group.
I am using System.Security.Principal to identify clients and allow
functionality based on the groups they belong to. In one case I would like
to let them know who can do the function they cannot. How do I list the
members of a group?
Thanks
Tom Tag: could not find schema information policyinjection Tag: 131739
Problem with SslStream when using Windows Vista
Hi.
When my client program runs under XP and calls a server (solaris in
this case) via an SslStream all is well. The client may make multiple
calls and multiple authentication calls and be fine. I expressly "clean up"
everything streamwise and socketwise and all is well.
Running the client under Vista, when the second authentication call is made
it returns the following SSPI error:
"A call to the SSPI failed, see inner exception"
which reads
"the Local Security Authority cannot be contacted"
Well that was pretty mystifying so I looked at what was going on with
ethereal. Apparently, on the second authentication go-round Vista asks the
server to re-use a session Id. The server responds and then
Vista rejects a re-used session Id (even though it asked to do that).
What I have found out is that the .net framework caches SslStream sessions
automatically, I have not found any way to turn this off for Vista - any
ideas on how to do this or to get Vista to use the cached SessionId which it
requested?
Here is a link to a sample that seemingly generates the same flaw that I
have described.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1222194&SiteID=1
Thanks Dave Tag: could not find schema information policyinjection Tag: 131731
DataMemberAttribute
Can a Dictionary<Tkey, Tvalue> DataMember in a DataContract holds objects
with different types? Tag: could not find schema information policyinjection Tag: 131728
Terminate a child process when parent process is killed
Hello,
I'm using a C# application to create a process "A" to execute an .exe file.
The problem is that when the application is killed (for example from task
manager) the child process keeps on running.
The question is how can i run the "A" process so that when my application is
killed or crashes the child process "A" will be terminated?
I'm using this code:
Process A = new Process();
A.StartInfo.FileName = some_exe_path;
A.Start();
Thanks in advance Tag: could not find schema information policyinjection Tag: 131724
.NET Framework 2.0 for Windows XP SP1
I noticed on the Microsoft .NET Framework 2.0 download page that Windows XP
SP1 is not a supported environment. Does this mean that the 2.0 Framework
will not work on an XP system with only SP1 installed?
The reason I ask is because I know someone who attempted to install the 2.0
Framework on three of his Windows XP SP1 computers, and each time the
install completely froze his system, although, after rebooting, it turns out
the Framework was installed successfully.
Thanks - Amos. Tag: could not find schema information policyinjection Tag: 131722
Windows Forms App as Console App
Hi
I want to start a Visual Basic Windows Form app from the console by
specifying parameters (this is possible in C#), is i add the following
method i get a error
Public Sub Main(ByVal args As String())
Console.Write(args.Length)
End Sub
the above method works in a console app.
can someone help in this regard
TIA
Barry Tag: could not find schema information policyinjection Tag: 131721
Wrapper assembly - VS2005!
Hi,
I am trying to use a managed dll (does not have a strong name) in my app/dll
which is signed. I get an error "Referenced assembly does not have a strong
name".
i tried using the tlbimp.exe to create a wrapper dll which has a strong name
but get the error "TlbImp : error TI0000 : The input file 'xyz.dll' is not a
valid type library.".
Any ideas on how i can do this? is there an equivalent of the project
property "Wrapper Assembly Key file in VS.Net" which i can use in VS2005.
Thanks,
- SA Tag: could not find schema information policyinjection Tag: 131720
DataTable.Select with condition with Timespan values
Hi to All,
i'm using C# in .NET 2.0 and i have a DataTable A with a column of
type TimeSpan used to store HOUR info.
I'm trying to filter my DataTable A selecting only rows that have the
column HOUR > ....
if i try to Call A.Select( " HOUR > '10:30:00' " ) i receive an
error
( cannot compare TimeSpan with String ...)
if i try to call A.Select ( " HOUR > 10:30:00 " ) i receive an error
( invalid token : )
if i try to call A.Select ( " HOUR >
Convert('10:30:00',System.TimeSpan) " ) i receive an error ( string
'10:00:00' is not a valid TimeSpan )
if i try to call A.Select ( " HOUR > #10:30:00#" ) i receive an error
( Cannot compare TimeSpan with Date )
...
...
i think that i missed only the right way to write my filter.
Can someone help me?
Thank you in advance.
Regards,
Massimo Tag: could not find schema information policyinjection Tag: 131719
Should be simple C++ managed header include question
I have a split container on my form,
from within one of them I wish to reach
the main from of the app. I'm having
problems with the headers and namespaces.
I want something like this:
//within right pane form
ABCForm^ abcForm = (ABCForm^)Application::OpenForms["ABCForm"];
abcForm->ExecutePublicFunction();
If I include the main form header I get:
'ABCForm' : undeclared identifier
'abcForm' : undeclared identifier
syntax error: ')'
and many more....
The two forms are of the same namespace.
if within the namespace I do this:
namespace ABC{
ref class VPEForm;
public ref class OtherForm : public Form
{
the line:
ABCForm^ abcForm = (ABCForm^)Application::OpenForms["ABCForm"];
will compile without complaint. But then the line:
abcForm->ExecutePublicFunction();
I get:
use of undefined type : 'ABC:ABCForm'
Like it sees the 'ref class VPEForm' as the complete definition of
the class.
So what's the proper way to reference the other form and handle
the includes and namespace from another form?
This should be simple I know...
Thanks,
Steven Tag: could not find schema information policyinjection Tag: 131718
Hook Event for All Property Set?
Can I have an example of wiring up an Event (handler) that can be
fired no matter what property Set accessor is touched? I have a lot of
get/sets on public properties and I would like to create something in
the class constructor that would be automatically called whenever
anything was Set.
Thanks. Tag: could not find schema information policyinjection Tag: 131717
MailMessage-Object error - net 1.1 , VS 2003
Hello,
I have a simple program which sends emails.
The main function is:
private bool InitAndSendEmail(string mailTo, string subject, string txt,
string mailFrom)
{
MailMessage myMail = new MailMessage();
try
{
myMail.From = mailFrom;
myMail.To = mailTo;
myMail.Subject = subject;
myMail.Body = txt;
string smtpServer = "mail.kybtec.de";
string userName = myMail.From;
string password = "12345678";
int cdoBasic = 1;
int cdoSendUsingPort = 2;
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver",
smtpServer);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
25) ;
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
cdoSendUsingPort) ;
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
cdoBasic);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
userName);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
password);
myMail.BodyEncoding = Encoding.UTF8;
myMail.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(myMail);
myMail = null;
return true;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
This works fine if I only send for example 10 emails.
If I send for example (loop based) 300 emails the following happens.
The first 100 emails are sent.
Now I get the exception. 'Could not access CDO.Message object'.
This is not a problem of the email server. Because:
If I wait for example 1 hour, I can again send 100 or so emails then the
error.
Or I can boot the computer, then I can send 100 or so emails and then the
error again.
Seems that there is something locked after a number of emails on the
computer.
Thank you for any help.
Rolf Welskes Tag: could not find schema information policyinjection Tag: 131716
Windowsservice needs to receive events
What is a good way to have a windowsservice receive events?
I want to change some settings of the service without restarting it
(mainly log-level of log4net ).
I thought about using MSMQ.
The problem I see with it is: If the service is not startet messages
are not consumed.
regards
Mathias Fritsch Tag: could not find schema information policyinjection Tag: 131714
WPF Question.
I'm not sure which is the right forum to post this question - so this is as
general as can be. There question is about treeview in WPF:
I'm trying to implement drag and drop in TreeViews, poking all sorts of
options for their display.
The code I'm based upon is Josh Smith's ListViewDragDropManager, and just
converted it to manage treeviews, with almost all of the same code. The
logics are all exactly the same, and the display is also from another project
I saw recently.
What I came across is just very weird:
when I expand a TreeViewItem, then collapse it, the TreeViewItem thinks it's
still expanded.
all of the DragOver events come from the incorrect treeviewitem, which is
ofcourse very bad.
The best way to understand what I'm saying is to look at this test project,
and do the following:
1. drag the first item around a little, see that you get all the normal
behavior.
2. expand the first item.
3. collapse the first item.
4. try the drag operations again. notice how when you pass over items from
the second row,
the mouse thinks it's over the first row treeviewitem.
solution is here(zip) :
http://www22.brinkster.com/betzera/ohev/dev301/treeview%20dragger.zip
10x,
Dani Tag: could not find schema information policyinjection Tag: 131712
I just reveal that "Make single instance Application" has side affect
if you use with Enable Application Framework, and check the option
"Make single instance Application" you can suprise to know that this
option Register tcp Chanel. So if you meant to register one by tour
self, your program give Error that you cant do it twice.
Any MPV to tel us why, and how?
(according my test, the "Make single instance Application" not prevent
multi instance on multi session on Terminal server. so why this option
not check by process name?) Tag: could not find schema information policyinjection Tag: 131707
Is this thread safe?
public void WriteToLog(string message)
{
StringBuilder bld = new StringBuilder();
bld.AppendFormat(null,"{0} {1}", DateTime.Now.ToString("yy-
MM-dd hh:mm:ss"),message);
StreamWriter sw = File.AppendText(m_LogFile);
sw.WriteLine(bld.ToString());
sw.Flush();
sw.Close();
}
MSDN says all static members in System.IO are thread safe, but here an
object of type StreamWriter is created from AppendText and I'm not
sure...... Do I need critical section or not?
Thanks! Tag: could not find schema information policyinjection Tag: 131702
V C++ .NET version 2003.Compiler problem.
V C++ .NET version 2003.Compiler problem.
My compiler is acting up. When I have building error, the left margin
pointer will point to the wrong line. Sometimes, the deferent between the
line that has the error and the line it pointed to can be more than twenty
lines.
Sometimes, It will give error message for something that I commented (//).
As soon as I delete the commented line, the building error will disappear .
I uninstalled the compiler and install it again: I still have the same
problem.
I used to have version 2005, I Uninstalled it and I still have the same
problem.
I recently installed the service pack recommended for this compiler.
I wonder if any body has experienced something like this, before. Or
anybody has an idea; what is the reason for that and how can I fix this
problem; I would appreciate it.
I recently installed the service pack recommended for this compiler Tag: could not find schema information policyinjection Tag: 131701
operator overloading
I have 2 objects which could be of any type (but both are of same
type)
I would like to check if it has the "greater than" or "less than"
operator overloaded. If it does, then i would like to compare the 2
objects using the operators. Is this possible to do?
In general, i am solving this problem, "If 2 objects can be compared,
return their comparison value".
I can check if they implement IComparer/IComparable but i don't know
how to proceed after that. Tag: could not find schema information policyinjection Tag: 131694
Limit of C# versus languages like Java?
There's tons of articles on the net that say that java works on
solaris, windows, mac etc. Does this mean Microsoft's C# is limited to
Windows? But if not, what limits does it have? Would everyone need
the .NET Redist. to run WEB applications? Is it any faster? Tag: could not find schema information policyinjection Tag: 131689
Unknown Properties in ASPX Pages
Hi
I have a aspx page which has the following properties (xat-???) , i get an
error on my local system, but its okay on the clients website.
xat-href="http://www.????.com/ShowAd.aspx?id=<%# Eval('id') %>"
xat-href-val="http://www.????.com/ShowAd.aspx?id=<%# Eval('id') %>"
xat-src="http://www.????.com/upload/{PreviewImageId}.Md.jpg"
xat-src-val="http://www.????.com/upload/45.Md.jpg"
does anyone know where these properties are comming from.
TIA
Barry Tag: could not find schema information policyinjection Tag: 131686
Machine locks up running app off network
I have a .NET application that is run off of a shared network drive.
About 5 users (out of 100) periodically have their entire machines
deadlock when they try to run the application. I was able to
reproduce the issue a couple times on one of the user's machines. One
time I had the Task Manager open when I launched the app and the Task
Manager also stopped responding (ctrl-alt-delete did nothing either)
I tried re-installing the .NET Framework, but I was still able to get
the machine to lock up when I launched the application. I also tried
running the application locally and was not able to get the machine to
lock up though this is not an ideal solution. The reason we run it
from the shared drive is so that we do not have to distribute updates
to every user.
I did some research and read about how deadlocks can occur in mixed-
mode dlls if you try to run managed code in the DllMain of the
unmanged code, but we do not have any unmanaged code in our app. Even
if we did, that would only deadlock the process it is running in and
not the whole machine, correct? It seems like the machine is
deadlocking when the CLR is loading the application but before it
starts executing b/c the splash screen for the app isn't shown before
the machine stops responding. Does anyone have any ideas on what
could be causing this behavior? Tag: could not find schema information policyinjection Tag: 131684
BUG? XmlSerializer serializes List<> { get; } property twice [LONG
Framework: .NET 2.0
Description: The code (see below) is an extract of a larger application. The
main points are:
1. There ist an abstract base class
2. This class has a virtual List<> { get; } property
3. The property is decorated with XmlArrayItem attributes
4. A class derives from the base class
5. This class overrides the List<> property
6. There is an identical (for the sample code, not in real life) other class
deriving from the abstract base class
7. The XmlSerializer gets both derived types as extraTypes in the constructor
One of the derived classes serializes correctly the other gets the List<>
property serialized twice. Actually this behaviour is much more strange:
1. If another (equal) derived class is added this shows that only the FIRST
extraTypes[] class is serialized correctly, all others got duplicate members
2. When the List<> is replaced by an Array [] { get; set; } there seems to
be no problem
Is this a known bug and especially is there a known work-around?
Regards
Jochen
############### SAMPLE CODE OUTPUT, ERROR IN C2 / D2 ########
....
<?xml version="1.0"?>
<B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w
3.org/2001/XMLSchema">
<All>
<A>
<All />
</A>
</All>
</B>
<?xml version="1.0"?>
<C xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w
3.org/2001/XMLSchema">
<All />
</C>
....
<?xml version="1.0"?>
<B2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.
w3.org/2001/XMLSchema">
<All />
</B2>
<?xml version="1.0"?>
<C2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.
w3.org/2001/XMLSchema">
<All>
<A2>
<All />
</A2>
</All>
<All>
<A2>
<All />
</A2>
</All>
</C2>
<?xml version="1.0"?>
<D2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.
w3.org/2001/XMLSchema">
<All>
<A2>
<All />
</A2>
</All>
<All>
<A2>
<All />
</A2>
</All>
</D2>
######### SAMPLE CODE ###############
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Xml.Serialization;
using System.Collections.Generic;
namespace StrangeSerializer
{
public class A
{
[XmlArrayItem(typeof(A))]
[XmlArrayItem(typeof(B))]
[XmlArrayItem(typeof(C))]
public virtual A[] All { get { return new A[0]; } set { } }
}
public class B : A
{
public override A[] All
{
get { return new A[] { new A() }; }
}
}
public class C : A
{
public override A[] All
{
get { return new A[0]; }
}
}
public class A2
{
private List<A2> m_List = new List<A2>();
[XmlArrayItem(typeof(A2))]
[XmlArrayItem(typeof(B2))]
[XmlArrayItem(typeof(C2))]
[XmlArrayItem(typeof(D2))]
public virtual List<A2> All { get { return m_List; } }
}
public class B2 : A2
{
public override List<A2> All
{
get { return base.All; }
}
}
public class C2 : A2
{
public C2()
{
base.All.Add(new A2());
}
public override List<A2> All
{
get { return base.All; }
}
}
public class D2 : A2
{
public D2()
{
base.All.Add(new A2());
}
public override List<A2> All
{
get { return base.All; }
}
}
class Program
{
static void Dump(A2 a)
{
XmlSerializer ser = new XmlSerializer(a.GetType(), new Type[] {
typeof(B2), typeof(C2), typeof(D2) });
using (MemoryStream mem = new MemoryStream())
{
ser.Serialize(mem, a);
mem.Seek(0, SeekOrigin.Begin);
using (StreamReader rdr = new StreamReader(mem))
Console.WriteLine(rdr.ReadToEnd());
}
}
static void Dump(A a)
{
XmlSerializer ser = new XmlSerializer(a.GetType(), new Type[] {
typeof(B), typeof(C) });
using (MemoryStream mem = new MemoryStream())
{
ser.Serialize(mem, a);
mem.Seek(0, SeekOrigin.Begin);
using (StreamReader rdr = new StreamReader(mem))
Console.WriteLine(rdr.ReadToEnd());
}
}
static void Main(string[] args)
{
Console.WriteLine("....");
Dump(new B());
Dump(new C());
Console.WriteLine("....");
Dump(new B2());
Dump(new C2());
Dump(new D2());
Console.ReadLine();
}
}
} Tag: could not find schema information policyinjection Tag: 131680
ClickOnce Problem with .NET Framework Installation
I have a C# application that I am distributing and updating via ClickOnce. I
have the .NET Framework 2.0 as a prerequisite. On some computers, but not
all, when the app is installed for the first time, and the Framework needs
to be installed, the Framework installation piece will hang the user's
computer. A reboot is normally required. What's odd about this is that the
Framework has been installed successfully but the computer hangs up.
Has anyone encountered this?
Thanks very much. Tag: could not find schema information policyinjection Tag: 131679
tcpclient in .net 2.0
Maybe someone has come across this situation and has a way to handle
it.
If I have a tcpClient object and do a GetStream.Read on it after
setting a ReceiveTimeout, I'm getting different behavior in .Net 2.0
than in 1.0 when the method returns 0 bytes (which signifies a
timeout). In both cases I get a System.IO.IOException , but in the
2.0 framework the socket also disconnects when this occurs (in 1.0 it
did not disconnect). They have made some improvements in the
tcpClient class, such as exposing the underlying socket, so I'd prefer
to keep using tcpClients. Any idea how I can prevent this
disconnect? Right now I'm checking DataAvailable and using
Thread.Sleep as a workaround, but I'd prefer to do a blocking read
call.
Thanks,
Keith Tag: could not find schema information policyinjection Tag: 131676
ClickOnce Content Files
I have a solution with multiple projects. One project is a
windows forms project. I have report files (.rdlc) in a separate
project that are built as "Content" with the "Copy Always" option.
When I build the solution, these files are copied to the bin\Release
directory, as they should be. However, when I publish the Windows
Forms project, these content files are not copied. How can I make it
so that these content files from the one project are published along
with the windows forms project.
They are not listed in the "Applications Files" section of the
publish settings.
Thank you... Tag: could not find schema information policyinjection Tag: 131675
Migrate large .NET 1.1 app to 2.0 or 3.0 (ie, when will SP's ship?
We're trying to decide whether to migrate a large .NET 1.1 (ELB 1.1) app to
.NET 2.0 or 3.0 (with ELB 3.1, probably)... within the next two months.
I've seen discussions that hint that the (long overdue) SP1 for .NET 2.0
will ship around the time that Orcas ships (early '08?). We could probably
tolerate that if we migrate the app to 2.0 now.
On the other hand, if we migrate to 3.0 now, when will SP1 for .NET 3.0
ship? Since 3.0 is purportedly an extension to 2.0, and isn't supposed to
have changed the "core" of 2.0, would we be able to apply 2.0 SP1 to 3.0?
But if the 2.0 SP1 doesn't also apply to 3.0, and the 3.0 SP1 will be even
later (1.5+ years, as the 2.0 SP has proven to be), then there's no way we
could consider migrating to 3.0 now...
DT Tag: could not find schema information policyinjection Tag: 131672
Images in DataList
Hi
In GridView there is <asp:ImageField > is there something similar to display
images in DataList, i need to display images stored in a Database
TIA
Barry Tag: could not find schema information policyinjection Tag: 131671
Control.Invoke() blocking forever if form closed whilst background task running
In part of the system I am working on I have a background task (started with
a call to BeginInvoke() on a delegate), which at some point needs to read a
property from one of the controls on a form.
Normally this all works great. The problem I am having is if the user closes
the form whilst the background task is running. Execution blocks
indefinitely on the call to Control.Invoke() and the method I supply to it
never begins. The application's message queue doesn't seem busy and the UI
is still responsive other than I have this thread sitting in the background,
stuck on this call. I am calling Invoke() on a custom UserControl that has
not yet been disposed.
The stack trace to where it is blocking inside Invoke() shows up as the
following...
[In a sleep, wait, or join]
mscorlib.dll!System.Threading.WaitHandle.WaitOne(long timeout, bool
exitContext) + 0x2e bytes
mscorlib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout,
bool exitContext) + 0x23 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle
waitHandle = {System.Threading.ManualResetEvent}) + 0xa1 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control
caller, System.Delegate method, object[] args, bool synchronous) + 0x36d
bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Invoke(System.Delegate
method, object[] args) + 0x48 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Invoke(System.Delegate
method) + 0x7 bytes
I can get around the problem by replacing the Invoke() call with a
BeginInvoke() and therefore being able to specify a timeout, but I'm curious
as to why it's happening in the first place.
Thanks
Dave Tag: could not find schema information policyinjection Tag: 131670
hi
I'm getting the warning
'could not find schema information policyinjection' in vs 2005, what
should I do?