onverting .tlb library produces incomplete types
Hi all,
I am trying to use a COM library from my .NET application.
I built .tlb from .idl file and run TlbImp.exe on .tlb to
produce an interoperability assembly. During conversion,
a number of warnings are issued:
....
TlbImp warning: Type IMyType is invalid and may only be
partially converted.
....
In resulting assembly all types referenced in these
warnings are incomplete, some members are missed. What is
the possible reason and how to work around the problem?
MIDL compiler says nothing about these types, so I can
guess that the problem is specific to TlbImp.exe
Thanks in advance,
Dmitry Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56949
Is socketbuffer empty?
Hello Fellow Developer,
This looks like a long mail, but at the end of this post is my socket
wrapper attached.
I want to make a timeout procedure that starts counting down after the
socketbuffer is empty.
This connection is being used to transmit data following a RFC so I cann't
create a control protocol that tells me the data was received.
(And even if I could, I want the timeout procedure to start after I send all
data, because that makes for me the most sense. (say I am sending 128mb the
socket will take longer sending then the timeout interval))
Any questions/remarks, NOT related to my question, pls ask directly via
email, dont post on the news server because It toke me alot of effort to
create this post.
Sample case:
if u send 1 byte from a client in Canada to a server in Australia with a 28k
modem thats being shared by an office of 30 people connected to the slowest
profider. (etc.)
What I want to say is that 1 byte may take a couple of minutes, and I use 1
byte as an
example because I don't want to make a question more complicated.
TCP/IP is a async protocol, but due to the Berkley Connection engine it
keeps track of what was send and received and what was not, so when there is
a packet loss it will send again.
So a socket keeps the data sequential, and if we are optimistic, the only
thing that can go wrong is a socket error.
There are three stadiums(simplified):
(A) My object sends to the Winsock, (buffer is being fed, no data on the
network, no data on the remote point)
(B) Winsock processes his buffer and sends on the network and waits for a
confirment that the package is succesfull transmitted(buffer is 'empty',
data on the network, no data on the remote point)
(C) All data is correctly processed and transported (buffer is truely empty,
no data on the network,data on the remote point)
Relative to the Sample case:
I achieve (A) ofcourse, I would really want to know (C), but I would be
satisfied with (B). I know (B) can be achieved, I hope (C) is too.
VB.NET FrameWork 2003(all patched and updated):
I use the System.Net.Sockets to send/receive data (no
tcpclient/tcplistener), I made a receivethread in my wrapper, the
receivethread loops/sleeps while waiting for data and then fires a
datareceived event.
Within the waitingloop there is a timeout function but this doesn't work
properly (It will never timeout).
When I send by System.Net.Sockets.Socket.Send(buffer()) (<--this can be
10Mb) then it imitially returns to my thread, so the (internal) Send method
buffers it.
The System.Net.Sockets.Socket is a wrapper around the Win32 Socket 2 API's,
it makes internal calls to those api's, so I started reading if they forgot
implementing some functions, but they are all implemented.
I tried:
- The beginSend/EndSend (Async way with callback when command is finished)
This calls within the async object the Socket.Send method, so its no
help, I can better do Socket.Send myself.
- The Socket.Blocking Property, it only blocks the Receive method,
Socket.Send goes directly in the buffer and then it returns immitially.
- Socket.Poll Method, returns the accessrights of the socket, "may I use
this socket to write?"
-
getSocketOption(Socket/TCP/IP,SendBuffer/ReceiveBuffer/SendLowWater/ReceiveL
owWater/SendTimeout/ReceiveTimeout) Method
Throws an Exception
MyWrapper.vb:
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Collections
Imports System.Threading
Imports System.Diagnostics
Public Class SmartConnection
Public Event ConnectionOpened(ByVal pMe As SmartConnection)
Public Event DataReceived(ByVal pMe As SmartConnection, ByVal Data As
Message)
Public Event CouldntConnect(ByVal pMe As SmartConnection)
Public Event ConnectionClosed(ByVal pMe As SmartConnection)
Public Event [Error](ByVal pMe As SmartConnection, ByVal pErr As
Exception)
Public Event TimeOut(ByVal pme As SmartConnection)
Private _Socket As Socket
Private _ReadThread As Thread
Private _StopThread As Thread 'Lookup threadingpool
Private _Closing As Boolean = False
Private _InError As Boolean = False
Private _lport As Long
Private lasttimeout As Long
Private pHost As String
Private pPort As Long
Private pRead As Boolean
Private pTimeout As Long
Private _Iswriting As Boolean = False
Protected Overrides Sub Finalize()
_ReadThread = Nothing
_StopThread = Nothing
_Socket = Nothing
MyBase.Finalize()
End Sub
#Region " Properties"
Public ReadOnly Property IsClosing() As Boolean
Get
IsClosing = (_Closing Or _Socket Is Nothing)
End Get
End Property
Public ReadOnly Property Connected() As Boolean
Get
Try
Connected = ((Not IsClosing) AndAlso _Socket.Connected =
True)
Catch e As Exception
OnError(e)
End Try
End Get
End Property
Protected ReadOnly Property Receiving() As Boolean
Get
Try
If Not Connected Then Throw New Exception("Socket is not
connected")
Receiving = ((Not _ReadThread Is Nothing) AndAlso
_ReadThread.IsAlive)
Catch e As Exception
OnError(e)
End Try
End Get
End Property
Public ReadOnly Property IPlocal() As String
Get
Try
If Connected Then IPlocal = EP2IPS(_Socket.LocalEndPoint)
Catch e As Exception
OnError(e)
End Try
End Get
End Property
Public ReadOnly Property IPremote() As String
Get
Try
If Connected Then IPremote = EP2IPS(_Socket.RemoteEndPoint)
Catch e As Exception
OnError(e)
End Try
End Get
End Property
#End Region
#Region " Connect"
Public Overridable Sub ConnectTo(ByRef hostName As String, ByRef port As
Long, Optional ByVal timeout As Long = 0)
Try
StartConnect(hostName, port, timeout, True)
Catch e As Exception
OnError(e)
End Try
End Sub
Protected Sub ConnectToWithoutReading(ByRef hostName As String, ByRef
port As Long, Optional ByVal timeout As Long = 0)
Try
StartConnect(hostName, port, timeout, False)
Catch e As Exception
OnError(e)
End Try
End Sub
Private Sub StartConnect(ByRef hostName As String, ByRef port As Long,
ByRef timeout As Long, ByRef read As Boolean)
Try
If Not _ReadThread Is Nothing Then Throw New Exception("Already
trying to connect")
_ReadThread = New Thread(AddressOf ConnectThread)
pHost = hostName : pPort = port : pRead = read : pTimeout =
timeout
_ReadThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub
Private Sub ConnectThread()
Try
If pHost = "" Then Throw New ArgumentNullException("hostname")
If pPort < IPEndPoint.MinPort Or pPort > IPEndPoint.MaxPort Then
Throw New ArgumentOutOfRangeException("port", "ArgRange_Port")
_Socket = New Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)
Try
_Socket.Blocking = True
_Socket.Connect(New
IPEndPoint(Dns.Resolve(pHost).AddressList(0), pPort))
_lport = CType(_Socket.LocalEndPoint, IPEndPoint).Port
If Not pRead Then
SetReadName("SC.Read[PreConnect]")
_ReadThread = Nothing
Else
SetReadName("SC.EarlyRead[" & _lport & "]")
End If
OnConnectionOpened()
If pRead Then Receive()
Catch e As SocketException 'e.ErrorCode = 10061
SetReadName("SC.Read[NoConnect]")
_ReadThread = Nothing
OnCouldntConnect()
Close()
End Try
Catch e As Exception
SetReadName("SC.Read[Error]")
_ReadThread = Nothing
OnError(e)
End Try
End Sub
#End Region
#Region " Receive"
Protected Sub StartReceive()
Try
If Receiving Then Throw New Exception("Receiving was already
started")
_ReadThread = New Thread(AddressOf Receive)
SetReadName("SC.LateRead[" & _lport & "]")
_ReadThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub
Private Sub Receive()
Dim i As Long
Dim b() As Byte
'Dim ds As String, dt As String
Try
Do While Connected
If pTimeout > 0 Then lasttimeout = CurrTick() + pTimeout
Do While _Socket.Available = 0
'dt = ds
'ds = "@" & _lport & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendBuffer) & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendLowWater) & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout)
'Debug.WriteLineIf(dt <> ds, ds)
_ReadThread.Sleep(ReceiveWait)
If IsClosing Then Exit Sub
If _Socket.Poll(0, SelectMode.SelectError) Then
'System.Runtime.InteropServices.Marshal.GetLastWin32Error())
'_Socket.GetSocketOption(SocketOptionLevel.IP,
SocketOptionName.Error)
OnError(New Exception("Socket Error"))
End If
If pTimeout > 0 Then
'If _Socket.Poll(0, SelectMode.SelectWrite) Then
'lasttimeout = CurrTick() + pTimeout
'Else
If lasttimeout <= CurrTick() Then
OnTimeOut()
Close()
Exit Sub
End If
'Endif
End If
Loop
ReDim b(_Socket.Available - 1)
'SyncLock _Socket
i = _Socket.Receive(b, SocketFlags.None)
'End SyncLock
If i < b.Length Then ReDim b(i - 1)
OnMessageReceived(New Message(b))
b = Nothing
Loop
Catch e As ThreadAbortException
Exit Sub
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region
#Region " Send"
Public Overridable Overloads Sub Send(ByRef data As String)
Try
Send(getbytes(data))
Catch e As Exception
OnError(e)
End Try
End Sub
Public Overridable Overloads Sub Send(ByRef data() As Byte)
Try
If Not Connected Then Throw New Exception("Socket isn't
connected")
_Iswriting = True
'SyncLock _Socket
_Socket.Send(data)
'End SyncLock
_Iswriting = False
Catch e As Exception
_Iswriting = False
OnError(e)
End Try
End Sub
#End Region
#Region " Close"
Public Overridable Sub Close() 'OR QUEE IT?
Try
If IsClosing Then Throw New Exception("Already is closing")
_Closing = True
_StopThread = New Thread(AddressOf DoClose)
_StopThread.Name = "SC.Stop[" & _lport & "]"
_StopThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub
Private Sub DoClose()
Try
_StopThread.Sleep(CloseWait)
Try
If Not _ReadThread Is Nothing Then
SetReadName("SC.Read[Close]")
If _ReadThread.IsAlive Then _ReadThread.Abort()
End If
Catch e As Exception
End Try
Try
If Not _Socket Is Nothing AndAlso _Socket.Connected Then
_Socket.Close()
Catch e As Exception
End Try
_ReadThread = Nothing
_Socket = Nothing
_Closing = False
_StopThread = Nothing
OnConnectionClosed()
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region
#Region " OnEvent"
Protected Overridable Sub OnError(ByRef pErr As Exception) 'If 2 errors
in diff threads?
Try
If Not _InError Then
_InError = True
Close()
_InError = False
End If
RaiseEvent Error(Me, pErr)
Catch e As Exception
Throw e
End Try
End Sub
Protected Sub OnTimeOut()
Try
RaiseEvent TimeOut(Me)
Catch e As Exception
OnError(e)
End Try
End Sub
Protected Sub OnCouldntConnect()
Try
RaiseEvent CouldntConnect(Me)
Catch e As Exception
OnError(e)
End Try
End Sub
Protected Sub OnConnectionClosed()
Try
RaiseEvent ConnectionClosed(Me)
Catch e As Exception
OnError(e)
End Try
End Sub
Protected Sub OnConnectionOpened()
Try
RaiseEvent ConnectionOpened(Me)
Catch e As Exception
OnError(e)
End Try
End Sub
Protected Sub OnMessageReceived(ByRef data As Message)
Try
RaiseEvent DataReceived(Me, data)
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region
Private Sub SetReadName(ByRef pName As String)
If Not _ReadThread Is Nothing AndAlso _ReadThread.Name Is Nothing
Then _ReadThread.Name = pName
End Sub
End Class Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56948
Serialization & Events problem
Hi,
I have a class which I have marked with the serializable
attribute. All the serialize code works untill I added an
event to the class. An now, when I come to serialize the
class, it wants to serialize the class where an event sink
is defined
I can only stop this by removing all the events from the
class before serialization, and adding them back after.
C# will not let me add [NonSerialized()] to the event
variable defintion.
Thanks
Peter Tewkesbury Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56945
Solution to maintain single instance
I want to maintain single instane of my application. So I use the following
code.
bool bCreateNew;
string strName = "Temp";
_Mutex = new System.Threading.Mutex(true, strName, out bCreateNew);
if (bCreateNew == false) {
IntPtr hPrePop = FindWindow(null,strWindowName);
if (hPrePop != IntPtr.Zero)
{
//Pop up the previous instance
ShowWindow(hPrePop);
SetForegroundWindow(hPrePop);
}
}
But my application is originally put in the tray, I want the application to
return from tray if the user attempt to open a new instance. So how can I
call the previous instance to set the the visiblity of the tray icon to be
false? What I mean is puting what code inside the if - block (i.e. if
(hPrePop != IntPtr.Zero)) can achieve my goal?
--
Franz Wong
My C++ and C# Site (Traditional Chinese) : http://www.franzwong.com Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56944
Exceptions and FileInfo.MoveTo
How can one test if a file is in use?
For example, the following code:
//Start Code Fragment
string sourceFile = "some source file path";
string targetFile = "some target file path";
FileInfo fi1 = new FileInfo(targetFile);
try
{
fi1.MoveTo(targetFile);
}
catch (Exception e)
{
Console.WriteLine("Unable to move the file: {0}", e.ToString());
}
//End Code Fragment
Throws the following exception:
//Start Exception
Unable to move the file: System.IO.IOException: The process cannot access
the fi
le because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.__Error.WinIOError()
//End Exception
Is it possible to test if a file is in use without trying to move it? I
can't seem to find anything.
thanks
ricky Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56940
passing structs from VB to C# and back to VB
Hi All,
I have the following situation:
Assembly VB defines a structure in VB.NET:
Public Structure TP
Public i As Integer
End Structure
Assembly CS (in C#) uses this structure and returns it from a function
CONV.exec() ). Additionally it defines a second test struct and a second
function to return the test struct:
public struct TST
{
public int i;
}
public class CONV
{
public static VB.TP exec()
{
VB.TP tp =new VB.TP();
tp.i=42;
return tp;
}
public static TST exec2()
{
TST tp =new TST();
tp.i=42;
return tp;
}
}
The assembly has a reference to assembly VB
Now the assembly VBCA (writen in VB) uses the C# assembly. It references
the VB and the C# assembly:
Sub Main()
Dim tst1 As VB.TP = CS.CONV.exec()'doesn't work, struct defined in VB
Dim tst2 As CS.TST = CS.CONV.exec2() 'works, struct defined in C#
End Sub
The compile of the first statement fails, when the Type is defined in a
VB assembly:
error BC30652: Reference required to assembly 'VB' containing the type
'VB.TP'. Add one to your project.
However, the second statement that uses a C# defined struct that is
absolutely identical to the VB one compiles and works.
Any ideas what is the culprit?
Thanks in advance,
Andy Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56935
Microsoft .NET Framework Version 1.1.4322.573
After I install .NET 2003 and framework, whatever I create
a web project and run it, it always has error message are
as follows:For example: open
http://localhost/QuickStart/default.aspxServer Error
in '/QuickStart' Application.Compilation ErrorDescription:
An error occurred during the compilation of a resource
required to service this request. Please review the
follonwing specific error details and modify your source
code appropriately.Compiler Error Message: CS0016 Could
not write to output
file "f:\WINDOWS\Microsoft .NET\Framework\v1.1.4322
\Temporary ASP.NET Files\quickstart\9fb6c2c8\_uksx8m-
..dl" - 'Access is denied.' The directory is always read
only. Even I login as administrator, I am not able to
change to read and write. Thanks for your help. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56923
Process API Security problem
This is the code that raises the exception:
Process[] processes = Process.GetProcessesByName("appName");
I'm running an application on W2K and I get:
System.InvalidOperationException due to Process performance counter being
disabled.
What is the resolution to this? Do I have to set some security permission in
the application before I call Process API? Or is this something that's done
in the .NET Framework Configuration? Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56922
Seeking for SVG, various file viewer library for .net
are there any SVG library for C#?
and..
any reporting engine that can generate html/excel/pdf file in .net?
and...
any html, excel, pdf, autocad file viewer?
thx... Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56918
Can't build 2002 originated projects in VS.Net 2003
When attempting to build 2002 originated projects in
VS.Net 2003 I keep getting this error: Assembly
Attribute 'System.Reflection.AssemblyVersionAttribute' is
not valid: The version specified '...*' is invalid.
The install of 2003 went fine. I uninstalled 2002 and
migrated the 2002 projects to 2003. Now I am stuck big-
time.
HELP! Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56916
Unable to start debugging on the web server. Server side-error occured on sendin
After reinstalling IIS on win xp pro (laptop),
.Net studio is not functioning well.
It compiles the code well, but when it tries to run in
debugging mode, it throws the folloing error
"Error while trying to run project: unable to start
debugging on the web server. Server side-error occured on
sending debug http request ....."
When I run without debugging, in browser it says
"Server Application Unavailable
The web application you are attempting to access on this
web server is currently unavailable. Please hit
the "Refresh" button in your web browser to retry your
request.
Administrator Note: An error message detailing the cause
of this specific request failure can be found in the
system event log of the web server. Please review this
log entry to discover what caused this error to occur. "
I could not find anything to resolve this issue. I would
appreciate if anybody could help.
Regards
M R Khan Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56911
Serious problem with ShowDialog and ShowInTaskBar=False
My product is an Add-In for Visual Studio .NET. Because the Add-In should
work with VS.NET 2002 and 2003, I am still compiling it with version 2002.
I have encountered a problem with the Form.ShowDialog() method, which only
occurs when running in VS.NET version 2003. However, I have no idea as to
whether the problem is specific to this constellation, in fact I doubt it.
Many of the forms in my project use COM controls. Following the advice in
Microsoft Knowledge Base Article - 312120,
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q312120
I have added the statement "Me.ShowInTaskbar = False" to the Form_Load
method of some forms.
The problem that occurs it that the method Form.ShowDialog() returns
immediately, without showing the form and returning the status Cancel!
Clearly this is intolerable and would appear to be a serious bug in the .NET
framework.
I have now, luckily, discovered that there is a connection between this
behaviour and the statement "Me.ShowInTaskbar = False" in the Form_Load
method. After commenting this statement out, the form is displayed correctly
(but with a fairly pointless button on the task bar).
As you can imagine, this is particularly annoying, since I added this
statement following instructions from Microsoft.
By the way, there is a newsgroup thread entitled "ShowDialog() returns
immediately with "Cancel"" describing a similar problem, indicating that it
is important to use the overloaded call Form.ShowDialog(IWin32Window). In my
case, this did not solve the problem.
Phil Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56908
The FREE .Net Framework means NOTHING IF SQL SERVER...........
SQL Server is easy to use....
Yet, "Easy-to-Use" is NOT IMPORTANT if it's not "Easy to AFFORD".....
Moreover, those who need it to be easy to use (those who don't have a
Fortune 500 IT staff)...need it to be easy to AFFORD.
***THE CATCH 22 ***
What good is a Free .NET Framework and a low cost Windows 2003 Server-Web
Edition, if SQL Server costs more than the server and ISP network connection
and amount to at sometimes at least 50% of the total costs when developers
have had to drop their hourly rate in half?
ANSWER: change your SQL Server licensing policies to be more friendly to mom
and pops instead having them run to PHP and MySql because they are not going
to MS Access after they have had PHP running nice and fine and then do a
port to sql server. Because they, MOM and POP and startup company are going
to be HAPPY with MySql and PHP and are NOT going to pay GOBS of money to do
an entire PORT when (by the time they really NEED a faster system) they
could just buy a faster computer.
PERIOD.....
Dear Microsoft and the Marketing department,
There can only be 500 companies in the Fortune 500....
That's why MySql and PHP are so hot right now......
Do not think that the developer and entreprenuer don't have to sit down and
total up the costs? And then see what the cost are for SQL Server and see
how they can double the total costs.
Don't have the CEO look at the licensing cost on the Microsoft SQL Server
page, their eyes will roll as the developer IS NOT going to be at the CEO's
side 24 hours a day. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56905
CodeBase and GAC and Location of Shared Assembly
Is the GAC the only place for shared assemly or I can redirect it to some
other place? I tried to change CodeBase for assembly in Gac, but it doesn't
work, because CLR looks first into the GAC and after that starts probing.
I don't know if I understand well but solution can be Publisher Policy
Assembly? I have found that I can create Publisher Policy File and link it
to the assembly and install it to the GAC. But I hope that I missed
something and there is some better way to do it.
Thanks Martin Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56904
Installer
How do I go about making sure that my install is installed for everyone and
not "just me" option in the default install?
Thanks for the help.
Chris Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56901
How to play an audio file?
How can I play an audio file (wav) file from a C# program?
--
Olav Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56896
How to parse string into DateTime?
I have a string containing a time and date string in the following format:
"HH:mm:ss MM/dd/YY" (example "14:34:12 12/31/02")
How do I parse this into a DateTime variable using C#?
Olav Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56893
Third-party help files not integrating with main .net help files
I have a third-party grid control that I am using. I installed it just
like I have done with other third-party controls that I have. Usually
after I install the control, and access help for the first time from
the IDE, I get a message saying that help is updating to reflect
recent changes, but I don't get it with this control so I cannot
access help for it. It is a .NET control and has all the correct help
files (not .CHM files). How can I force the controls help files to
intergate with .NET help?
Thanks in advance! Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56891
Process.GetProcesses accesses floppy drive
Hi,
it's been asked a couple of month ago, but without an answer. Maybe now
somebody knows. So, why does calling Process.GetProcesses access the floppy
drive?
Thanks in advance.
--
Armin Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56887
Version nuber is not incrementing
I have default attribute in my assemblyinfo file:
<Assembly: AssemblyVersion("1.0.*")>
and I expected, that revision number should be incrementing as I rebuild an
assembly, because It shoul be a number of seconds from midnight divided by
2.
But I have the same assembly version regardless I made new build.
Why my assembly version automaticaly doesn't increments?
Thanks Martin Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56885
Console vs Service Application
I'm writing an application that needs to run every x minutes, read in some
data from a log file and then write it out to a database.
Originally I was going to write it as a service but the more I think about
it I feel it would work just as well as a console application that is
scheduled using the Windows scheduler.
I'm just curious as to whether there are any other advantages to using a
service that I might not have thought of?
Here are some reasons why I thought a console application would be
acceptable:
1. It is easier to schedule the console application using the Windows
scheduler or 3rd party scheduling applications, using a service I would
need to write scheduling code into it
2. It doesn't matter if the application is manually run between scheduled
periods
3. It could be handy to write output to the console so if someone manually
runs it that can see what is happening
Any thoughts would be greatly appreciated.
William D. Bartholomew Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56880
Empty columns when exporting to excel from crystal reports
Hi,
I tried this demo application in here (watch for any line breaks in the
URL):
(http://support.crystaldecisions.com/communityCS/FilesAndUpdates/vbnet_win_a
dodotnet.exe.asp
When exporting to Excel there is an empty column after each actual column in
the excel.
Why? Is this a normal behaviour? Is it impossible to get rid of the empty
columns when using the export funtion of the report?
Please clarify me so that I can decide to either use the export
functionality of the report or to implement my own excel export. I rather
use the export functionality of the report itself if I can get rid of the
empty columns.
--
Thanks in advance
Ali Eghtebas Sweden Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56879
Question: How do you retrieve Properties provided by an ExtenderProvider through reflection?
Hi,
I've written a simple ExtenderProvider that provides a string property
(Let's call it CustomStringProperty) to all the buttons on a form. The
ExtenderProvider itself is placed on a base form (It is protected, so
derived forms will inherit it's functionality) and provides the
CustomStringProperty to all forms derived from it.
It's canonical and works well. It allows the values to be assigned
during design time. Thereby easing the development of new forms and
insuring that all the buttons on new forms (that derive from the base
form containing the ExtenderProvider) have the CustomStringProperty.
Now I'm writing a small external tool that is attempting to extract
these CustomStringProperty(s) through reflection and log their value
in a database.
However, It's my understanding that the values of the
CustomStringProperties are assigned during the InitializeComponent()
method call of the associated forms (which to my knowledge doesn't get
executed during reflection). And I don't think that the properties
extended by the ExtenderProvider show up in the fieldinfo of the
buttons themselves, rather that you must go throught the
ExtenderProvider during runtime. Am I wrong?
Any advice would be welcome.
Thanks
Jason Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56878
efficient C# coding
I'm looking for a good article on efficient C# coding. All the DotNet
efficient coding articles I can find are oriented toward VB.NET, and while
some principals still apply, many do not. For instance there is no
equivalent of
with (some object)
.
end with
in C# (or somebody straighten me out).
Somehow in the my early studies of C# I got the (apparently wrong)
impression that it had some kind of great compiler that made all the good
practices I learned in VB unnecessary. Consider the following:
private static void LoadHeadings(UltraWebGrid Grid, XmlNode[]
PrevHeadingArray, SortedList FootnoteList, int CurRow)
{
for (int i = 0; i < PrevHeadingArray.Length; i++)
{
Grid.Rows[CurRow].Cells[i].Text =
PrevHeadingArray[i].Attributes["text"].Value
+
SuperFootnotes(PrevHeadingArray[i].SelectNodes("child::note"),
FootnoteList);
Grid.Rows[CurRow].Cells[i].Style.VerticalAlign =
VerticalAlign.Top;
}
}
I need to access the same cell twice, and I do it down a fairly long path.
Nowhere have I seen it advised to assign the object to a local variable and
then access it, yet when I did that the following code generated
considerably less code in the debugger disassembly:
private static void LoadHeadings(UltraWebGrid Grid, XmlNode[]
PrevHeadingArray, SortedList FootnoteList, int CurRow)
{
for (int i = 0; i < PrevHeadingArray.Length; i++)
{
UltraGridCell oCell = Grid.Rows[CurRow].Cells[i];
oCell.Text = PrevHeadingArray[i].Attributes["text"].Value
+
SuperFootnotes(PrevHeadingArray[i].SelectNodes("child::note"),
FootnoteList);
oCell.Style.VerticalAlign = VerticalAlign.Top;
}
}
I can't really interpret the assembler code, but I figure less code is
usually a good proxy for more efficient code.
Judging from my VB experience the next step would be to assign
"PrevHeadingArray.Length" to a local integer. Am I on the right track?
I really don't have the time to pursue these interesting investigations, and
I haven't taken the time to instrument the example above and see what the
comparative elapsed times are, I would much rather read this all spelled-out
somewhere. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56877
Version Changes 1.0 to 1.1
I have a simple aspx page that used to run properly in
framework 1.0. Now that I moved to 1.1 the validation
controls do no run. I just installed Framework 1.0 and
also changed the
config file so accept 1.0:
<configuration>
<startup>
<supportedRuntime version="v1.0.3705" />
</startup>
</configuration>
But still does not work. The page does run the control
validations.
Any ideas ?
Thanks,
Sergio Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56869
Read from COM port?
I need to read messages from a device connected to a COM port with the
following format:
When the controller is configured to report events, it will transmit a new
message every time the event
occurs. The message follows the following format:
XX <Message> {CR} {LF} {Terminator}
. "XX" is the Message ID Number. Each type of report message from the
controller has a unique ID
number in a 2-digit hexadecimal format. Each digit will be a hexadecimal
value (numbers 0-9 or
letters A-F). When converted to decimal format, they represent the numbers 0
through 255. By
reading these two bytes, a user program can quickly identify the type of
message from the
controller.
. "<Message>" will contain a text description of the event.
. {CR} signifies that a carriage return is sent.
. {LF} signifies that a line feed is sent.
. {Terminator} signifies that a single-byte terminator code is sent. The
byte has a value 1d, which is
the ASCII code SOH (this is NOT the number 1, which is ASCII value 49d). The
terminator is
provided to make it easier for a computer program to read and interpret the
messages from the
controller.
What framework clases are best suited for reading this kind of messages from
the device? Can you specify the terminator character which is at the end of
each message?
--
Olav Tollefsen Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56862
Installutil.exe does not register windows service
Hi,
I have written a Windows Service (using C#) using the .Net framework
and to install the same am using the Installutil.exe tool. However
inspite of no errors returned in the InstallLog file the custom
service does nto get installed. Am I missing something here...
Also the following is logged in the InstallLog file...
"No public installers with the RunInstallerAttribute.Yes attribute
could be found in the d:\denz\service\xmlgenservice.exe assembly.
Remove InstallState file because there are no installers."
Do I need to reference the Windows installers here... (Think this is
the missing link...)
Any pointers will be appreciated...
TIA,
Denzil Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56857
.armx?
I've noticed on various msn.com webpages the .armx
extension. Perusing various search engines has turned up
nothing except for a single webboard thread which talked
about msn.jp and someone's theory that it is a
personal .NET extenstion system for MSN.com because you
can easilly create your own extensions. Is this true?
And if not? Just what is this? Some sort of new
technology? I doubt they'd want to replace asp.net so
soon, right?
Sincerely,
Res,
Resurrection20@yahoo.com Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56854
ADO.net
Hey,
i am bit concerned about the architecture
provided in the .net frame work for ado.net.
The disconnected architecture does nor serves you best on
the desktop application. As you are not connected to
database and if any other changes the table in the
database you are not notified or your side data is still
older one.
As it was not in ADO we use to set the recordset
properties to our need and we were quite happy. but not
now.
Example:
Dim rs as ADODB.Recordset
TextBox1.databindings.add("Text",rs,"id") (X)
which is not allowed by the .net frame work, as i am
using the Recordset that is in ADO not in ADO.Net and its
required interface is not present.
But i want to do that ... as it is quite easy to
use this structure. I think there is problem with
Microsoft they dont even support there ADO properties in
their .net TextBox or any other control.
They should provide the Implementation of
connected recordset or simply implement the IList
interface or any other interface that is required for the
data binding in .net fram work.
thanx,
Rizwan Ahmed Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56843
Determining the computer name I am installing to.
I have a deployment project that installs a web
application. I have added an installer class to my
application project that gets called during install.
Using System.DirectoryServices.DirectoryEntry I can add a
group to the computer I am installing on. Currently I am
using the hard coded name of my computer. How can I find
out the name of the computer I am installing to?
FYI: I have tried to use the
System.Windows.Forms.SystemInformation class but it
doesn't seem to be available from my web project
Installer class. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56836
How to validate date of birth
Hello! I have a three <Select> button which running on
server first option button allows select month, another
day, and third year. I tried to validate these tree select
controls using custom validater server control, where i
created java script and connected to this script function,
but no results. If you know how to validate it please let
me know. Thank you for help. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56831
TcpClient lost data timing anomaly
Hi
The platform: XP/pro on a dual Xeon 3GH processors
I am using TcpClient class to communicate with a POP3 server.
Short problem synopsis: a 'read' hangs even though there is data in the
buffer (as evidenced by a network sniffer trace).
Elaboration:
I/O is done by getting the NetworkStream and doing a read for a whole
buffer's worth (typically 1024) of bytes.
The code looks for the NL (new-line char, '\n'), as a delimiter. If found,
the text up to and including the NL is returned to the caller. Otherwise
another read is performed and concatenated to the previous read's output,
and the check for the delimiter repeats. On subsequent reads, if there was
data left over from the previous read, it is processed for NL before any
other reads are issued.
I have used a network sniffer to determine that all the data is coming in.
I have put a trace in my program to output to a file (serialized with a
'lock') all the output form all the read requests.
I consistently find that one of the reads is able to get all but the last 3
bytes of a response from a server. The code dutifully returns all the text
received and tries to do another read since the caller is looking for a
'.\r\n' sequence (end-of-message). This read hangs (I use the debugger).
When I change the buffer size the problem happens in a different message. If
I make the buffer large enough, the problem goes away.
The buffering code described above is working for thousands of messages that
have split across multiple buffers or for short messages where multiple fit
in the same buffer, so I'm pretty confident that it is splitting messages
correctly and gluing together segments across network messages.
My only conclusion is that something in the TcpClient (or deeper) is
checking the socket and waiting for more data in a non-atomic manner. The
problem shows up on my system because it is a fast dual processor system
that can obviously do concurrent processing by multiple threads/processes.
Has any one seen this kind of problem before?
Any work-around?
-TIA
David Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56822
problem removing asseblies from the GAC
I have installed some assemblies to the GAC.
Used the call gacutil /i <assembly> to install it.
When using the gacutil /u or the /uf (to force)
I get the error message:
Assembly: PSICMDRx, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=03c0acb6b75 ec2e1, Custom=null Assembly
could not be uninstalled because it is required by
Windows Installer Unable to uninstall: assembly is
required by one or more applications Pending references:
SCHEME: <WINDOWS_INSTALLER> ID: <MSI> DESCRIPTION :
<Windows Ins taller> Number of items uninstalled = 0
I didn't use the windows intaller to intall these
asseblies.
I have also tried to remove with the Microsoft .NET
Framework 1.1 Configuration util
Nothing works.
Is there anyway I can remove these?
Thanks SidS Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56821
C# to VB .NET Conversion?
Hi,
Im converting some code from C# to VB .NET and it's giving me some trouble.
Below are the snippets. I get the syntax error "End of statement expected"
so I added implements and it gives me '.' expected.
Any ideas?
If ya can help i will give you a free copy of the software :)
Thanks.
C# ------- No Errors
namespace nsTest
{
public delegate void MyDelegate();
public class test
{
public event MyDelegate MyEvent;
}
}
VB .NET ------ Errors
Namespace nsTest
Public Delegate Sub MyDelegate()
Public Class test
Public Event MyEvent MyDelegate '<-- error this way = End of
statement expected
Public Event MyEvent MyDelegate '<-- error this way = '.' expected
End Class
End Namespace Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56820
Event Reflection
Hi,
I have a class which has a lot of events (>100). For some reasons, I have to
go through all invocation lists to do something. What I'm wondering is that,
is there any way to use reflection to get their InvocationList without going
through each event?
// tedious
foreach (Delegate handler in Event1.GetInvocationList()) {...}
foreach (Delegate handler in Event2.GetInvocationList()) {...}
foreach (Delegate handler in Event3.GetInvocationList()) {...}
...
foreach (Delegate handler in Event189.GetInvocationList()) {...}
// user reflection???
....
Looks like this is a hard question as I haven't googled any answers. Thanks
BK Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56818
Threading help with Invoke
I created a call-back Thread class and am getting an
Invoke error in the call-back method. The call-back
method access a control on the main thread. I understand
why the error is occurring, however, I don't know the
(Invoke?) syntax for correct it. I've played around with
MethodInvoke but cannot seem to get it to work. Has
anyone done something similar?
Here's a generic version of my code:
The call-back found in a Form:
private void worker_DataSetRetrieved(object sender,
DataSetRetrievedEventArgs e)
{
populateTreeView(e.DataSet);
}
The thread class et. al.:
internal class RequestQueueDataSetRetrieverThread
{
public event DataSetRetrievedHandler
DataSetRetrieved = null;
private string _user = "";
public RequestQueueDataSetRetrieverThread()
{
_user = Common.CurrentUser;
}
public RequestQueueDataSetRetrieverThread(string
user)
{
_user = user;
}
public void Start()
{
if (DataSetRetrieved == null)
return;
DataSet dataSet = getMyDataSet(_user);
DataSetRetrieved(this, new
DataSetRetrievedEventArgs(dataSet));
}
}
internal class DataSetRetrievedEventArgs: EventArgs
{
private DataSet _dataSet;
public DataSetRetrievedEventArgs(DataSet dataSet)
{
_dataSet = dataSet;
}
public DataSet DataSet
{
get
{
return _dataSet;
}
}
}
internal delegate void DataSetRetrievedHandler(object
sender, DataSetRetrievedEventArgs e); Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56817
Framework 1.0 and 1.1
IS it a good procedure to run both framworks in the same
machine 1.0 and 1.1?
Thanks,
Sergio Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56806
.net framework and virtual PC on Macs
Does the .net framework work under virtual PC for Macs?
Specifically, I need Visual Basic.net to work on the new
virutal PC 6.1 version. Is this possible? Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56805
Problems with GCHandle and AppDomains
Greetings everyone.
I am currently working on a multimedia application written in unmanaged
code. As part on my next set of improvements, I would like to host the CLR
in the application and allow third parties to extend the application and
manipulate internal objects in the application through a "script" interop
layer I provide written (on my end) in managed C++.
The way my system is set up, from the default domain in my host, I
instantiate the script harness using AppDomain::CreateInstanceAndUnwrap
method and downcast the resulting object to a common interface that my
application and the harness know about. I call a "run" method on the
interface. In a test script I created, I register a callback object into
the multimedia app. The unmanaged callback object contains a GCHandle to a
delegate which it fires periodically on behalf of the unmanaged application
based on certain timing parameters.
Now, when the harness and my test script used to run in the default domain,
everything worked like a champ. Now that the test script is in a different
domain, when the unmanaged callback object dereferences the gchandle to
invoke the delegate on the script, I get an ArgumentException with a
description that reads: "Cannot pass a GCHandle across app domains". I've
hit my head against the wall trying to get this to work for a while now with
no success.
Does anyone have any idea what I could be doing wrong?
Thanks in advance for any help you can give.
Dan Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56804
Localization and multiple string resources
Hello!
I am looking at .Net localization. I happen to be using J# with VS
2003 but it could be any supported language.
The LocalizedHelloWorld example from MSDN and VS shows how to localize
a single .resources file. Here is a link to the J# version:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vjsample/html/vjsamlocalizedhelloworldsamplesatelliteassembliesforconsoleapplications.asp
The problem I have is I am working with an application that has
several string resources per DLL. I have not been able to find a way
to get it to work.
The example loads a resource called
"HelloWorld.Resources.MyResources". Each localized version is
embedded in a DLL called "HelloWorld.resources.DLL". The trick seems
to be that there can be only one such DLL.
I have modified this sample and tried embedding two resources,
MyResources.resources and MyResources2.resources, and also creating,
for example, two French resources, MyResources.fr.resources and
MyResources2.fr.resources, into the satellite assembly
"HelloWorld.resources.DLL". But, when I request
"HelloWorld.Resources.MyResources2" with the culture set to "fr", it
fails to find the second French resource and falls back to the
embedded MyResources2.resources.
Does anyone know a way to make this work?
Thanks in advance. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56803
.NET on WinNT 4.x?
I just read something that somewhat bothers me.... Does the .NET framework,
along with apps compiled by VB.NET (just compiled apps - not VB.NET itself)
run on Windows NT 4.x? We are mostly W2K, but I am coverting a LARGE
application that will need to run on all our PCs - and some of those PCs are
still Win NT.
Thanks.
Tom Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56802
Microsoft .NET Framework Setup Failed
I have a clean install of Win 2K sp3 . Nothing else installed. When I go to
install the .net framework I get the error Microsoft .net framewoprk
installation failed.
Any ideas as to why?
Thanks
Dennis Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56797
Unable to open module that doesn't exist.
I get this message:
Unable to open module file 'C:\...\Copy of
crUnderCrossHome.vb': The system cannot find the file
specified.
That file does not exist. How can I get rid of this
message? Thanks. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56795
page validation framework 1.1
Hi there,
I have page using validation controls. The page works
fine in framework 1.0 but now that I am testing it in
framework 1.1 does not work. It does not do the
validation..
any ideas ?
thank you
sergio
p.s. This incompatibility is becoming the DLL hell
in .NET. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56793
Path of a Process
Hi all,
does it is possible to get the full path name of a process
knowing the ProcessName (get by
Diagnostics.Process.GetCurrentProcess.ProcessName)?
How can I know it?
Regards
Antares Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56791
MSI Installation
Using the Visual Studio .NET Installer...
In the user interface for an installation, I would like to
create a dialog box to take the connection information for
a SQL Server database and verify it, before proceeding to
the next screen.
This means I would need to call code when the user
clicks next on the dialog window somewhere. Are there
methods one can overload when the user clicks the
Previous\next buttons.
I think I can generate a new form in the windows
installer class to show it and have the user fill it out,
however I would like to do this in the VS.net install
wizard.
Any articles that do the same thing would help.
thanks in advance for any help Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56783
How to FTP?
(Replies followed to: microsoft.public.dotnet.framework only)
What is the best method of transferring files
between FTP servers using .Net Framework
using C#?
Is there a .Framework API that that enables a C# app to
behave like an FTP client?
Please help. Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56780
Method call parameter values
is it possible to do the following thing: ?
class MyClass
{
private int val1;
private string val2;
...
private type valM;
public void func1(arg1,arg2,...argN)
{
try{
//some operations...
}
catch(Exception ex)
{
string AllContextData;
//In this place I would like to get All values
//of argumets passed to function currently
//having been entered (in this situtaution Func1)
//Also, I want to get values (and names if
//possible)of all class members. These all values
//i want to put into AllContextData (after
//ToString()method call on each value) and pass
//outside in MyException class.
//IS IT POSSIBLE ?
throw MyException(AllContextData,ex);
}
}//func
}//class
Thanks
Michal Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56775
prevent new line in datagrid
Hello Newsgroup!
I have a DataGrid. In the cells of this DataGrid are strings displayed which
consists of more then one word. When the collum of the DataGrid is not wide
enough, ervery word of the hole string is displayed in a own line in the
cell.
How can i prevent the newline?
Any ideas?
Thanks! Tag: Why my .net 2003 ide occures error C00CE508 when i start it. Tag: 56774
Hello,
When i start .net 2003EA ide, i get a XML parsing error message.
how can i to solve it.