Globalization question.
I create a class library. Then I add default resource file to support
globalization and add strings. I want to use these resource strings outside
of this assembly, but I see that the generator makes all strings as internal
static properties.
Is there any way to make them public, so I can use them from another assembly? Tag: share size Tag: 128413
Problem with (string, string) constructor when extending the Uri class
I have the following rather simple code, where I want to extend the
Uri class in order to add a couple of handy methods.
public class Uri2 : Uri
{
public Uri2(string baseUri, string relativeUri)
: base(baseUri, relativeUri)
{ }
}
But I get the following error when compiling: "The best overloaded
method match for 'System.Uri.Uri(string, bool)' has some invalid
arguments", and the problem seems to be that there is another
overloaded constructor for the Uri class that takes two arguments, the
second one being a boolean in stead of a string.
I've tried casting the relativeUri explicitly and I've tried adding
the (string, bool) constructor to my Uri2 class, but no luck so far.
Note: The (string, bool) constructor for the Uri class has been made
obsolete. Could this the answer to the why the compiler is confused?
I guess that the answer is pretty straight forward if just you know C#
a little better than I do. Can anyone out there help? Tag: share size Tag: 128407
Debugging
I have a situation with an apparent deadlock. I have two threads
which are blocked on the statement "lock(_SyncRoot)", where _SyncRoot
is my own private object. However, I've examined all the other
threads in my application and walked up their callstacks, and none of
them seem to be holding a lock on this object. Moreoever, I never
lock this object in any way other than using the lock keyword, and
it's never in a nested lock. So it seems to me that a deadlock is
provably not possible.
Is there some sort of debugger command that will tell me which thread
is holding the lock on this object?
Thanks Tag: share size Tag: 128401
Windows Workflow Visual Designer
Is possible to use the Visual Designer of WWF to replace my Flowchart
Editor/Container application? what i mean is that i just need to use
the Visual Designer to replace my MFC-based Flowchart Editor since i
already have a Container to contain the flowchart-object(s) in my
Flowchart Editor. Tag: share size Tag: 128400
Console application will only run on machine where application was compiled
I have written a simple console application that will only run on my
machine. I can run the application outside of the IDE, but on other
units I get a message that the system cannot execute the command.
I installed VS 2005 on another computer to see if there was some kind
of dependency problem but this did not help.
I created a new project and compiled it with all of the default
options, no luck.
The program compiles fine and executes without any errors on my
computer. This tells me that I have some type of a dependency issue,
the question is where do I look to find the problem?
Thanks for any input. Tag: share size Tag: 128391
RegEx and Vb.net /// "Unrecognized escape sequence"
I have a fairly simple RegEx code below.
I am given a file name, (which I don't control) , and need to change a
folder name in it.
The code below is choking on the filename not being escaped.
"Unrecognized escape sequence"
While I can escape the findValue and replaceValue,
I don't necessarily control the fileName value. Aka, all I can do is
manually string.Replace the fileName value. (Unless someone knows better
than I)
Do I have to do a string.Replace here? ( to make all the \ into \\ )
Or am I missing some trick in vb.net.
----------Start VB.Net code
Dim fileName As String
fileName = "C:\wutemp\myfile.txt" '<< this is given to me, I cannot simply
say " filename = "C:\\wutemp\\myfile.txt" "
Dim replaceRegEx As System.Text.RegularExpressions.Regex = New
System.Text.RegularExpressions.Regex(fileName, getRegexOptions())
Dim findValue As String = "\wutemp\"
Dim replaceValue As String = "\newfolder\"
Dim newFileName As String = replaceRegEx.Replace(fileName, findValue,
replaceValue)
Private Function GetRegexOptions() As RegexOptions
Dim options As RegexOptions = New RegexOptions
options = options Or RegexOptions.IgnoreCase
Return options
End Function
PS
This is a repost. But I marked the other post (in .language.vb) as "IGNORE
do not reply here".
.. Tag: share size Tag: 128388
The generic type 'System.Collections.ObjectModel.Collection`1' was used with the wrong number of generic arguments in assembly 'mscorlib'
Has there been any resolution to this?
I am seeing the same problem.
The code seems to run ok but while I am stepping through it while
debugging VS shows the value of count in my watch window as this
error:
{"The generic type 'System.Collections.ObjectModel.Collection`1' was
used with the wrong number of generic arguments in assembly 'mscorlib,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.":"System.Collections.ObjectModel.Collection`1"}
Integer
Like I said the code seems to be running ok but I am concerned that
there is an underlying problem.
Basically I have an abstract base class that derives from
System.Collections.ObjectModel.Collection(Of T).
I then have classes that derive from my base class.
Any thoughts? Tag: share size Tag: 128386
digital sign
hi,
i need help with "digital sign" and p7m files.
i need to build a tool that have to complete these task:
web app:
-user download document on a server
-read digital sign from smart card (on client)
-add sign to the document
-upload to server signed document
is it possible ???
How can i accomplish it ?
smart client,hosted com in ie aren't problem ...
i need info oon read smart card and add sign!
Is possibile to read "digital sign" from smart card
and send it to server, so server can complete task ... ???
thank so much for help
marco Tag: share size Tag: 128385
xxxx.dll.config file for what? (Setting for DLL)
VS2005
I have Class library that serve as COM. I put some setting to the
My.Setting, the compile create file with name: xxxx.dll.config
Now I read that config not work with DLL, I try that, and it's seem
that true, this is not working. this is true? and why the compiler
create this file on bin\debug folder? Tag: share size Tag: 128379
Rich test box in DataGridView Control
Hello Everybody,
I am trying to implement RichText box control into DataGridView Control.
Would be greatful if anyone guides me how to implement it.
Thanks,
Kapil
From http://www.developmentnow.com/g/6_2006_5_15_0_0/dotnet-framework.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com Tag: share size Tag: 128377
Enterprise Library 2.0 configuration error
It is my intent to utilize the Enterprise Library Application Blocks.
I am new to dotNet. I have downloaded the 'Enterprise Library -
January 2006' version. The solution built successfully and I can
execute the 'Hands on Labs' for logging. To transition to my code
base, I did the following:
created a C# console application,
added the project references
(Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.ObjectBuilder.dll),
created the app.config file with the 'Enterprise Libray Configuration'
utility (contents below),
saved and closed both solution and configuration files.
When I execute the solution within Visual Studio 2005, I receive the
following error:
The configuration section for Logging
cannot be found in the configuration source.
A section with the name of "loggingConfiguration" definitely exists.
It is like it does not see my app.config file.
- app.config contents -
<configuration>
<configSections>
<section name="loggingConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null" />
</configSections>
<loggingConfiguration name="Logging Application Block"
tracingEnabled="true"
defaultCategory="General"
logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add source="Enterprise Library Logging" formatter="Text
Formatter"
log="Btest" machineName=""
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
traceOutputOptions="None"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
name="Formatted EventLog TraceListener" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message:
{message}
Category: {category}
Priority:
{priority}
EventId: {eventid}
Severity:
{severity}
Title:{title}
Machine:
{machine}
Application Domain: {appDomain}
Process
Id: {processId}
Process Name: {processName}
Win32
Thread Id: {win32ThreadId}
Thread Name:
{threadName}
Extended Properties: {dictionary({key} -
{value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed
Category" />
<errors switchValue="All" name="Logging Errors &
Warnings">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
</configuration>
- MyLoggingBTest.cs contents -
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Logging;
namespace MyLoggingBTest
{
class Program
{
static void Main(string[] args)
{
LogEntry log = new LogEntry();
log.Message = string.Format("Logging has been successfully
added to the application ");
Logger.Write(log);
}
}
}
Would anyone be willing to steer me in the right direction?
Thanks Tag: share size Tag: 128376
"Certificate chaining error" attempting to sign ClickOnce manifests with mage.exe
Up until now, we've been signing our manifests using the temporary
certificate built by Visual Studio. We now have a certificate from
Thawte. Since Thawte only provided an ".spc" and ".pvk" file, and
mage.exe requires a ".pfx" file, I had to use the pvk2pfx tool to
create the pfx file. When I run mage to sign, like this:
mage -s myapp.exe.manifiest -cf ourcompany.pfx -pwd xxx
We get the subject error message. I consulted with Thawte, and they
provided another microsoft tool (pvkimprt.exe) to generate the pfx
file. That didn't work either - same error.
Can anyone shine any light on this? I don't even know what the error
message means... Tag: share size Tag: 128375
ASP.NET multiple pages with very similiar layout and logic
I have a complex page (with 8 complex user controls, and many other
asp.net controls.) I have 2 very similiar pages to create, each page
differing only from the others in one control.
What is the best way to achieve this? I would guess that I have 3
alternatives.
1.) Visual and Logic inheritance. I know absolutely nothing about this
in ASP.NET, and I haven't found anything that appears immediately
simple ( i am in a rush to get this job done!).
2.) Have one page with all the controls on, and pass a parameter in
the request for the page informing it which identity it should assume
- i..e. if "PageA" is sent in the page request, the page should behave
like and contain the controls of a "PageA" type page, etc... This
would appear simple, though the different pages are to have different
security permissions - I intended for each page to be in its own
folder with the web.config file for that folder definining the access
rights for the logged in user. Having one page to do the work of 3
would mean that I would have to do the configration work in the top
level web.config file, which seems a bit more onerous.
3.) Put the contents of the page I have in now into a user control,
and put this user control into 3 different pages. My main worry about
this is the degree of processing overhead involved at the server,
since the control would be complex (many controls + 8 user controls
within it). However, it would mean that I could have 3 distinct pages
that I could more easily apply user access rights to.
I'm from a winforms background, so a lot of the concepts are quite new
to me - I'd appreciate any feedback on this.
Regards,
Greg. Tag: share size Tag: 128368
Reflection and Inheritance question.
I'm new to reflection and would like to know if what I want to do is
possible. So far I haven't seem much value to reflection (for my
needs) but that could be the result of not using it properly, or
perhaps my architecture is inherently flawed.
I have the following:
class baseClass
{
protected object _sharedProperty;
public new baseClass(){}
public object Shared
{
get {return _sharedProperty;}
set {_ sharedProperty = value;}
}
public void SharedMethod()
{
// do something
}
}
class classA : baseClass
{
private object _property1;
public new classA(){}
public object Property1
{
get {return _ property1;}
set {_ property1 = value;}
}
}
class classB : baseClass
{
private object _property2;
public new classB(){}
public object Property2
{
get {return _ property2;}
set {_ property2= value;}
}
}
public static void Test(string className,object propertyValue)
{
Type runtimeClass = Type.GetType(className);
if(((int)myEnum.value1 & runtimeClass.Shared) != 0)
{
System.Reflection.PropertyInfo myProperty =
runtimeClass.GetProperty("Property1");
myProperty.SetValue(runtimeClass,propertyValue,null); <- fails
here
}
if(((int)myEnum.value2 & runtimeClass.Shared) != 0)
{
System.Reflection.PropertyInfo myProperty=
runtimeClass.GetProperty("Property2");
myProperty.SetValue(runtimeClass,propertyValue,null); <- fails
here
}
}
So, basically both ClassA and ClassB inherit from baseClass. They
obviously share properties/methods but also have their own.
Based on certain conditions I want to set a property value of a class
(if it exists - I'm not testing for it in the code provided but plan
on it) without knowing which class until run-time. The class that I
want to instantiate will be only known to the procedure as a string
value.
I'd like to be able to dynamically declare a variable as type
"className" at run-time based on what the string value is passed in
(for the sake of example say that the string being passed in IS the
fully qualified name of the class. I then want to be able to access
and enter property values for the particular class.
But the problem I'm having is that when I try to set my property value
the first argument of the SetValue expects an instance of an object
with the type equal to that which I'm trying to set (which I think is
kinda dumb given that if I knew it I would probably just instantiate
it and set the properly directly). Anyway, clearly I don't know what
this object is supposed to be so I don't know how to get past this
exception.
Does anyone have any thoughts? What I'd love to do is something along
these lines (pseudo-code):
public static void Test(string className,object propertyValue)
{
baseClass runtimeClass = new baseClass();
if(((int)myEnum.value1 & runtimeClass.Shared) != 0)
{
((className)runtimeClass).Property1 = propertyValue;
}
if(((int) myEnum.value2 & runtimeClass.Shared) != 0)
{
((className)runtimeClass).Property2 = propertyValue;
}
runtimeClass.SharedMethod();
}
What I don't want is the following because this can and will get quite
enormous given the number of properties and flag values I have:
public static void Test(string className,object propertyValue)
{
baseClass runtimeClass = new baseClass();
if(((int)myEnum.value1 & runtimeClass.Shared) != 0)
{
if (className == "ClassA")
{
((ClassA)runtimeClass).Property1 = propertyValue;
}
if (className == "ClassC") <-- assume this class also inherits from
baseClass
{
((ClassC)runtimeClass).Property1 = propertyValue;
}
}
if(((int) myEnum.value2 & runtimeClass.Shared) != 0)
{
if (className == "ClassB")
{
((ClassB)runtimeClass).Property2 = propertyValue;
}
if (className == "ClassC") <-- assume this class also inherits from
baseClass
{
((ClassC)runtimeClass).Property2 = propertyValue;
}
}
runtimeClass.SharedMethod();
}
Thanks,
Frank Tag: share size Tag: 128367
IO.Filestream: write single byte (.Net 1.1)
Hi,
I use an IO.Filestream to write a single byte close to the end of a huge
file (120 GB) by setting the Position property and calling the WriteByte
method. This takes 40 minutes because all the bytes before the byte
to be written seems to be written. But I only want to write a single byte
into the file! How can this be done?
Armin Tag: share size Tag: 128359
UdpClient Stop Receiving Broadcast Datagram On Lan When Connect to Internet
My code is below and the platform is Win2K3 R2:
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace TechUDPBroadcast {
class Program {
static void Main(string[] args) {
const string addr = "224.1.3.99";
const int prt = 12799;
UdpClient udpc = new UdpClient();
udpc.Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReuseAddress, true);
udpc.Client.Bind(new IPEndPoint(IPAddress.Any, prt));
udpc.EnableBroadcast = true;
udpc.JoinMulticastGroup(IPAddress.Parse(addr));
ManualResetEvent abort = new ManualResetEvent(false);
WaitHandle[] evs = new WaitHandle[2];
evs[0] = abort;
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate {
while (true) {
IAsyncResult asy = udpc.BeginReceive(
new AsyncCallback(delegate(IAsyncResult iasy) {
IPEndPoint rp = null;
byte[] recv = udpc.EndReceive(iasy, ref rp);
Console.Write(".");
}), null);
evs[1] = asy.AsyncWaitHandle;
if (WaitHandle.WaitAny(evs) == 0) return;
}
}));
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate {
for (int i = 0; i < 1000; i++) {
udpc.Send(new byte[] { 0x1, 0x2 }, 2,
new IPEndPoint(IPAddress.Parse(addr), prt));
Console.Write("+");
Thread.Sleep(1000);
if (abort.WaitOne(0, false)) return;
}
}));
Console.ReadKey();
Abort.Set();
}
}
}
The code is simple and has no tricky. UdpClient broadcast
datagram every second, another thread receive it asynchorously.
When it is running at LAN, sending & receiving are OK.
Then i connect the PC to Internet, the UdpClient stop receiving!
This happened with or without Windows FireWall.
Is this a bug of DotNetFramework?
greenxiar Tag: share size Tag: 128353
UDPClient Broadcast Receive Error with PPPOE
My Computer is Win2K3 R2, Code is:
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace TechUDPBroadcast {
class Program {
static void Main(string[] args) {
const string addr = "224.1.3.99";
const int prt = 12799;
UdpClient udpc = new UdpClient();
udpc.Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReuseAddress,
true);
udpc.Client.Bind(new IPEndPoint(IPAddress.Any, prt));
udpc.EnableBroadcast = true;
udpc.JoinMulticastGroup(IPAddress.Parse(addr));
ManualResetEvent abort = new ManualResetEvent(false);
WaitHandle[] evs = new WaitHandle[2];
evs[0] = abort;
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate {
while (true) {
IAsyncResult asy = udpc.BeginReceive(
new AsyncCallback(delegate(IAsyncResult
iasy) {
IPEndPoint rp = null;
byte[] recv = udpc.EndReceive(iasy, ref rp);
Console.Write(".");
}), null);
evs[1] = asy.AsyncWaitHandle;
if (WaitHandle.WaitAny(evs) == 0) return;
}
}));
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate {
for (int i = 0; i < 1000; i++) {
udpc.Send(new byte[] { 0x1, 0x2 }, 2,
new IPEndPoint(IPAddress.Parse(addr),
prt));
Console.Write("+");
Thread.Sleep(1000);
if (abort.WaitOne(0, false)) return;
}
}));
Console.ReadKey();
Abort.Set();
}
}
}
When my computer is single network connection(Local Network),
the code works fine. My problem is, when i connect the Internet with PPPOE,
the UDPClient can not receive the broadcasting data!
Why?
greenxiar Tag: share size Tag: 128345
gc.KeepAlive - is this the reality of garbage collection
Hello,
I have a problem with garbage collection.
An msdn example says generally the following:
I have a class TestCls.
With a Property MyProp.
Then normally I would write:
void MyFunc()
{
TestCls tc = new TestCls();
int u = tc.MyProp;
.... no further use of tc ....
}
The example says this would not work, because the gc could work (finalizer
called) before tc.MyProp has finished.
This is a catastroph.
The example says I had to write:
void MyFunc()
{
TestCls tc = new TestCls();
int u = tc.MyProp;
.... no further use of tc ....
gc.KeepAlive(tc);
}
Think about this, if you have many such objeckts and calls in a method.
Furthermore:
I have tested the example of the msdn: gc Class/ GcMethodes/KeepAlive
Methode
which is at
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref2/html/M_System_GC_KeepAlive_1_b4c5a2da.htm
in Msdn VS 2005.
I mean the FIRST example.
I have a computer with 2 cpus (intel dualcore), but the example does not
works as described.
So question is it reality?
Have I to use in this case (only manged code, no interop) the
KeepAlive-Method?
(I only mean this sample with pure dotnet, if I use interop the use of
KeepAlive is clear for me).
Thank you for any help.
Rolf Welskes Tag: share size Tag: 128342
Use C# assembly in MFC - help
Hi
I want to retrofit a C# class library assembly into legacy MFC C++
applications. The application projects are VS2005 or VS2003 projects but
are unmanaged MFC C++ apps. I believe one approach is to enable COM
interoperability in the C# assembly and use it as a COM library in the
c++ app. Are there any other possible solutions without requiring
recoding of the c# modules etc or any major rework? Thanks! Tag: share size Tag: 128338
Problem Using XmlElement(Order:=...
Would it more likely be Visual Studio 2002 or Net Framework 1.2 that would
need to be upgraded in order to get my VB.NET project to understand the
following code, which is used to control the serialization order of object
properties when using XMLSerializer?
<XmlElement(Order:=1)>_
Public Property Field1....
...
...
End Property
I'm getting an error that says: Field or property 'Order' is not found. On
MSDN, I found a solution, saved in 2005, which uses this technique.
Phil Tag: share size Tag: 128331
WPF FlowDocument user interaction
Hi,
Is there any way to enable user to interact with FlowDocument like resize
and drag to change layout?
Thanks.
Jim Tag: share size Tag: 128327
Problem with using created COM object with C#.NET 2005 under Excel
This is part of my assembly:
[assembly: ComVisible(true)]
[assembly: ClassInterfaceAttribute(ClassInterfaceType.None)]
// The following GUID is for the ID of the typelib if this project is
exposed to COM
[assembly: Guid("cd099def-f9fb-407f-b793-9db68f6b8a0b")]
This is my code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Globalization;
namespace ExtraStuff
{
[Guid("4E3BBC1B-625F-47bf-BE80-DAB84F1934BE"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch),
ComVisible(true)]
public interface IExtraStuff
{
[DispId(1)]
double F2C(double val);
}
[Guid("F88DAD68-578A-4e23-BCFF-0FBBEC1C4B55"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(IExtraStuff)),
ComVisible(true)]
public class ExtraStuffClass : IExtraStuff
{
public ExtraStuffClass()
{
}
public double F2C(double val)
{
return ((5.0/9.0) * (val - 32.0));
}
}
}
and excel vb code:
Option Explicit
Public Function F2C(val As Double) As Double
Dim ccw As ExtraStuff.IExtraStuff
Set ccw = New ExtraStuffClass
F2C = ccw.F2C(val)
End Function
I put my dll to C:\Program Files\Microsoft Office\OFFICE11\ and I registered
that by:
regasm /tlb /codebase ExtraStuff.dll
And when I'm trying use it I get error:
'Run-time error '-2147024894 (80070002)'
In oleview.exe raport everything seems to be OK. Can anyone solve my problem
? Tag: share size Tag: 128324
How to get the folder name for the Windows recycle bin?
Bearing in mind the Windows recycle bin folder has had 3 names since
Win 95 up to Vista:
x:\RECYCLED (95, 98)
x:\RECYCLER (NT, XP, 2000, 2003)
x:\$Recycle.bin (Vista)
Consider iterating through the the root folder of a drive, and
excluding the recycle bin from your results. It is unacceptable to
simply ignore folders named "RECYCLED", "RECYCLER" or "$Recycle.bin"
by string comparison because, for example, a Vista user may have
created their own "Recycled" folder.
Is there a set of constants for these folders, or a way of discovering
the recycle bin folder for a given volume in .NET?
Consider too that the drive might not be local, and may be accessed
remotely by system share (e.g. \\machine\C$\)
Boz Tag: share size Tag: 128323
System.Convert.ToInt64(String) method exception
This statement (txtNewOdometer is a variable for an edit box):
lSN = System.Convert.ToInt64(txtNewOdometer.Text);
is causing an exception iff a zero ('0') is entered into the textbox. But
only on one user's computer; works fine on everyone elses.
The exception's Message is "Input string was not in a correct format."
Does anyone have any idea whatsoever on what could be happening, or what
further steps I can take to analyze this problem?
Any help greatly appreciated! Tag: share size Tag: 128322
obtaining full stack trace in release mode from a thrown exception?
Hello,
If I have the following code excerpt where I call m1() in release
mode. my stack trace output shows only m1 and m4 and not the
intermediate method calls.
I obtain the full information in Debug mode. However this information
is critical even in Release mode, is there away to obtain it?
cheers,
shelby pereira
public void m1(){
try
{
m2();
}
catch (Exception e)
{
Console.WriteLine(e.StackTrace);
}
}
void m2(){
m3();
}
void m3(){
m4();
}
void m4()
{
throw new Exception("exc in m4");
} Tag: share size Tag: 128314
UriFormatException from WSE in 2.0, not in 1.1 (need help)
I'm developing an ASP.NET 2.0 site wich uses some 1.1 assemblies built
by our team (server and win client is still 1.1, web is 2.0). The
problem is that my use of thiese assemblies - wich uses WSE 2.0 SP3 -
suddenly throws an exception. We can't find any code changes that
should cause this. The exception is:
System.UriFormatException: Invalid URI: The Authority/Host could not
be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind
uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.Web.Services2.WebServicesClientProtocol.set_Url(String
value)
I have varified that the URI supplied is valid. I have also created
two test websites, one in .net 1.1 and on in 2.0, running the exact
same code as the problem website, and now I find that while the 2.0
test still fails the 1.1 works fine.
The exception occurs when creating a WSE proxy for making web service
calls to our web services. But there are very similar calls already
made before this exception happens. I'm really at a loss here.., we're
trying to set up differen testing environments, but nothing has given
us any clues yet. The site/code worked fine two days ago, then it
stopped working.., what should I do? Anyone?? Is it a problem with
using WSE 2.0.3.0 for .net 1.1 under the 2.0 framework? Any
workarounds? Tag: share size Tag: 128310
SMTP error
I use Outlook 2000. I've been sending messages to a particualr address for
months all of a sudden I'm now getting the following message back.
SMTP error from remote mailer after initial connection:
They have checked their end but there is nothing coming in to their server.
I can still receive messages from them but they don't appear to be receivng
messages from me.
HELP! Tag: share size Tag: 128308
FileStream.Close() Exception - How to release the lock?
Hello!
Using .NET v2.0.50727, I've attached some sample code that creates a file in
a network path (test.er-1):
- The file is created at a network path.
- The user disconnects his/her network cable.
- The file is attempted to write to.
- The user reconnects his/her network cable.
- The file is closed - WHICH fails and results in the exception "The handle
is invalid"
This results in that the filelock remain active until the process is
terminated... Any suggestions on how to close the file in the same scenario?
Best Regards,
Fredrik Johansson
[code]
private FileStream fs1;
public void Runme() {
lock (this) {
string networkFile = @"\\anyserver\anyshare\test.er-";
// open the file
Console.Write("Creating Files (OK expected)...");
try {
fs1 = new FileStream(networkFile + "1",
FileMode.CreateNew, FileAccess.Write, FileShare.Read);
Console.WriteLine("OK");
} catch (Exception e) {
Console.WriteLine("FAILED\r\nThe test can not be
performed. Please modify the networkFile parameter!");
Console.WriteLine("\r\nPress ENTER to exit...");
Console.ReadLine();
return;
}
// wait for user to disconnect
Console.Write("Please disconnect from your network, press
ENTER to continue...");
Console.ReadLine();
// try to write some data - this will fail
try {
Console.Write("Attempting to Write (FAILED expected)...");
byte[] ba = Encoding.Default.GetBytes("Hello World");
fs1.Write(ba, 0, ba.Length);
fs1.Flush();
Console.WriteLine("OK - Did you really disconnect your
drive?");
} catch (Exception e) {
Console.WriteLine("FAILED");
}
Console.Write("Please connect to your network, press ENTER
to continue...");
Console.ReadLine();
// try to close the file - this will fail
try {
Console.Write("Closing File (this WILL fail)...");
fs1.Close();
fs1 = null;
Console.WriteLine("OK - Both files are supposidly
closed...");
} catch (Exception e) {
//
===================================================================
// break here "The handle is invalid" - but the filelock
is still on?!
Console.WriteLine("FAILED");
}
Console.WriteLine("\r\nPress ENTER to exit...");
Console.ReadLine();
}
}
[/code] Tag: share size Tag: 128306
.NET Runtime error
Hi everybody,
I'm facing an unidentified problem related to .NET framework. On event
viewer, the following message is logged:
Source: .NET Runtime 2.0 Error Reporting
Category: None
Type: Error
EventID: 5000
Description: EventType clr20r3, P1 pos.exe, P2 3.3.2636.21715, P3 4600f8b6,
P4 system, P5 2.0.0.0, P6 4333ae87, P7 3246, P8 273, P9
system.formatexception, P10 NIL.
This problem seems to be happened in ramdom during the execution of
application. When this problem occurrs, my application have to quit and
restart again. My application is compiled by VB.NET 2005. I have no idea
the cause of this problem.
The runtime environment is:
* Intel P4 2.0G with 512MB
* Windows XP Professional with SP2 and latest pathces
* SQL Server 2000 Desktop edition with latest patches
* .NET Framework 2.0 with latest patches
Thanks a lot for your attention and kindly advice!
Regards,
James Wong Tag: share size Tag: 128304
Windows Communication Foundation
I need to implement a Service with CallBack Contract and setting
TransportMode in binding configuration set to Streamed.
When i try to instance ServiceHost it's throw an
System.InvalidOperationException with Message like 'Contract Require
Duplex but on Binding Configuration is not Supported or is not been
Configured'
How Can I use Streamed TransportMode and Duplex Communication Service?
Xml Configuration:
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="NewBehavior">
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="NewBinding0" transferMode="Streamed" />
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="NewBehavior"
name="CallBackService.CallBackService">
<endpoint address="CallBackService"
binding="netTcpBinding" bindingConfiguration="NewBinding0"
contract="CallBackService.ICallBackService" />
<endpoint address="CallBackService/mex"
binding="mexTcpBinding"
bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://acquleobook" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
P.S.
I'm using for callback One-Way OperationContract due to fix WinForms
Main Thread Deadlock.
Thanks Tag: share size Tag: 128302
Jit 64bit
Hi all,
my team developed an application that partly is .net and uses a
win32 dll that we don't want to port to 64 bit.
We compiled the .net part of the application telling the compiler to
output x86 code.
The application doesn't seem to work well anyway since some external
assembly doesn't work like expected on WIN2003 x64. I think this
external assembly are jitted to 64bit. Can we force the jit of all the
program to x86 code?
TIA
Marco Tag: share size Tag: 128301
My .NET service dows not stop in a controlled way
I developing an application based on some windows services on .NET framework
1.1. Eatch service are a single process service. Each service connects to SQL
Server or Oracle database and derives an customiced TCP server class. I
notised that the SCM calls the OnShutdown method when the system shutsdown
and the OnStop method at service stop from SCM. The service stop from SCM
calls the OnStop with different thread than the Main function and the service
stops in a controlled way after the OnStop returns but the OnShutdons is
called with same thread as the Main during the shutdown or restart cycle and
the process will not be stopped in a controlled way. All database connections
in the application database connection pool will remain open in the Oracle
servcers point of view. This cause an out of available connections for the
services after system reboot. I created a clean service to make shure that no
external thread is locked and added some tracings shown in the code below. I
also attached the output from the trace file. I really hope that someone find
some wrong in my code.
-----------------------
Stefan S
/Thanks on advance
The Threadid are obtained with the Thread.GetHashCode() method.
15:04:09, ThreadId:2 Main Called
15:04:09, ThreadId:5 OnStart Called, and Returns
15:04:17, ThreadId:5 OnStop Called
15:04:17, ThreadId:5 StopService Called
15:04:17, ThreadId:5 StopService Returns
15:04:18, ThreadId:5 OnStop Returns
15:04:18, ThreadId:2 Dispose Called
15:04:18, ThreadId:2 Dispose Returns
15:04:18, ThreadId:2 Main Returns
15:05:16, ThreadId:2 Main Called
15:05:16, ThreadId:5 OnStart Called, and Returns
15:05:50, ThreadId:2 OnShutdown Called
15:05:50, ThreadId:2 StopService Called
15:05:51, ThreadId:2 StopService Returns
15:05:51, ThreadId:2 OnShutdown Returns
public class C_TstSvc : ServiceBase
{
Thread oStartThread;
///--------------------------------------------------------------------
/// Constructor
///
/// Parameters:
/// void
///--------------------------------------------------------------------
public C_TstSvc()
{
ServiceName = "Test_Server";
this.CanStop = true;
this.CanShutdown = true;
}
///--------------------------------------------------------------------
/// The main entry point for the service
///
/// Parameters:
/// void
///--------------------------------------------------------------------
static void Main()
{
Log( "Main Called");
System.ServiceProcess.ServiceBase oServiceHanlder = new C_TstSvc();
System.ServiceProcess.ServiceBase.Run( oServiceHanlder);
Log( "Main Returns");
}
///--------------------------------------------------------------------
/// Startup the Tst as service
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void OnStart(string[] args)
{
Log( "OnStart Called, and Returns");
oStartThread = Thread.CurrentThread;
}
///--------------------------------------------------------------------
/// Stop the Tst service
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void OnStop()
{
Log( "OnStop Called");
StopService();
Log( "OnStop Returns");
}
///--------------------------------------------------------------------
/// Called when system shuts down
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void OnShutdown()
{
Log( "OnShutdown Called");
StopService();
Log( "OnShutdown Returns");
oStartThread.Abort();
}
///--------------------------------------------------------------------
/// Called when system shuts down
///
/// Parameters:
/// void
///--------------------------------------------------------------------
private void StopService()
{
Log( "StopService Called");
Thread.Sleep( 500);
Log( "StopService Returns");
}
static private void Log( string sMsg)
{
Thread iCurrentTread = System.Threading.Thread.CurrentThread;
StreamWriter m_oFileWriter;
m_oFileWriter = File.AppendText( "c:\\Aniware\\Test\\TestService.log");
m_oFileWriter.NewLine = "\r\n";
m_oFileWriter.WriteLine( DateTime.Now.ToLongTimeString() + ", ThreadId:"
+ iCurrentTread.GetHashCode() + " " + sMsg);
m_oFileWriter.Close();
}
///--------------------------------------------------------------------
/// Clean up resourses állocated by this object
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void Dispose(bool disposing)
{
Log( "Dispose Called");
base.Dispose (disposing);
Log( "Dispose Returns");
}
} Tag: share size Tag: 128300
Service does not stop in a controlled way
I developing an application based on some windows services on .NET framework
1.1. Eatch service are a single process service. Each service connects to
SQL Server or Oracle database and derives an customiced TCP server class. I
notised that the SCM calls the OnShutdown method when the system shutsdown
and the OnStop method at service stop from SCM. The service stop from SCM
calls the OnStop with different thread than the Main function and the
service stops in a controlled way after the OnStop returns but the
OnShutdons is called with same thread as the Main during the shutdown or
restart cycle and the process will not be stopped in a controlled way. All
database connections in the application database connection pool will remain
open in the Oracle servcers point of view. This cause an out of available
connections for the services after system reboot. I created a clean service
to make shure that no external thread is locked and added some tracings
shown in the code below. I also attached the output from the trace file. I
really hope that someone find some wrong in my code.
-----------------------
Stefan S
/Thanks on advance
The Threadid are obtained with the Thread.GetHashCode() method.
15:04:09, ThreadId:2 Main Called
15:04:09, ThreadId:5 OnStart Called, and Returns
15:04:17, ThreadId:5 OnStop Called
15:04:17, ThreadId:5 StopService Called
15:04:17, ThreadId:5 StopService Returns
15:04:18, ThreadId:5 OnStop Returns
15:04:18, ThreadId:2 Dispose Called
15:04:18, ThreadId:2 Dispose Returns
15:04:18, ThreadId:2 Main Returns
15:05:16, ThreadId:2 Main Called
15:05:16, ThreadId:5 OnStart Called, and Returns
15:05:50, ThreadId:2 OnShutdown Called
15:05:50, ThreadId:2 StopService Called
15:05:51, ThreadId:2 StopService Returns
15:05:51, ThreadId:2 OnShutdown Returns
public class C_TstSvc : ServiceBase
{
Thread oStartThread;
///--------------------------------------------------------------------
/// Constructor
///
/// Parameters:
/// void
///--------------------------------------------------------------------
public C_TstSvc()
{
ServiceName = "Test_Server";
this.CanStop = true;
this.CanShutdown = true;
}
///--------------------------------------------------------------------
/// The main entry point for the service
///
/// Parameters:
/// void
///--------------------------------------------------------------------
static void Main()
{
Log( "Main Called");
System.ServiceProcess.ServiceBase oServiceHanlder = new C_TstSvc();
System.ServiceProcess.ServiceBase.Run( oServiceHanlder);
Log( "Main Returns");
}
///--------------------------------------------------------------------
/// Startup the Tst as service
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void OnStart(string[] args)
{
Log( "OnStart Called, and Returns");
oStartThread = Thread.CurrentThread;
}
///--------------------------------------------------------------------
/// Stop the Tst service
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void OnStop()
{
Log( "OnStop Called");
StopService();
Log( "OnStop Returns");
}
///--------------------------------------------------------------------
/// Called when system shuts down
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void OnShutdown()
{
Log( "OnShutdown Called");
StopService();
Log( "OnShutdown Returns");
oStartThread.Abort();
}
///--------------------------------------------------------------------
/// Called when system shuts down
///
/// Parameters:
/// void
///--------------------------------------------------------------------
private void StopService()
{
Log( "StopService Called");
Thread.Sleep( 500);
Log( "StopService Returns");
}
static private void Log( string sMsg)
{
Thread iCurrentTread = System.Threading.Thread.CurrentThread;
StreamWriter m_oFileWriter;
m_oFileWriter = File.AppendText( "c:\\Aniware\\Test\\TestService.log");
m_oFileWriter.NewLine = "\r\n";
m_oFileWriter.WriteLine( DateTime.Now.ToLongTimeString() + ", ThreadId:"
+ iCurrentTread.GetHashCode() + " " + sMsg);
m_oFileWriter.Close();
}
///--------------------------------------------------------------------
/// Clean up resourses állocated by this object
///
/// Parameters:
/// void
///--------------------------------------------------------------------
protected override void Dispose(bool disposing)
{
Log( "Dispose Called");
base.Dispose (disposing);
Log( "Dispose Returns");
}
} Tag: share size Tag: 128299
System.Transaction and MSDTC
We are developing a .NET 2.0 based distributed application and use
System.Transaction namespace to handle transaction at Business Object level.
DAAB 2.0 is used at Data Access Layer level. The database is SQL server 2000
(installed in Windows 2000 server).
The .NET server components are deployed in Windows 2003 server. When we
attempt to run the application, it throws exception saying â??DTCâ?? service is
not running. We are not sure why DTC is a prerequisite for System.Transaction
which defeats the purpose of choosing the same. We have also customized the
DAAB not to close the connection when the transaction scope is alive but it
does not help (This is implemented based on DAAB 3.0).
Will system.transaction use DTC by default with SQL server 2000? If so, is
DTC a prerequisite in this scenario? There are few articles states SQL 2005
will not require DTC. Any supporting links or inputs on this would help us.
Appreciate your help.
Thanks and Regards
Rasheed Tag: share size Tag: 128296
ReadOnlyCollection and Multiple Threads
I've been really leveraging the ReadOnlyCollection class the last few weeks,
figuring that it works exactly as it's name describes.
Yesterday I was rudely reminded that reading the documentation for a class
is very important, and that making silly assumptions is also bad.
It turns out the ReadOnlyCollection isn't readonly at all, and that
iterating over it isn't a good thing. I looked all over the Web and various
Newsgroups for other people who have run across this, and all of the
examples I found were wrong. Many, many people have made the same mistake
that I did.
http://www.coversant.com/Default.aspx?tabid=88&EntryID=34
In a nutshell: The ReadOnlyCollection class is not thread safe. If a
different thread changes the underlying IList<T> then the contents of the
ReadOnlyCollection change, and all of the standard threading problems arise.
The Documentation says exactly this, so it's simply a case of failing to
RTFM.
--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins Tag: share size Tag: 128276
Help using Formatter FormatterServices and FormatterConverter
I am looking for an example to implement a subclass to the Formatter class.
I need to serialize an object graph and control the output to the stream,
like the character set, the data formats, and stream's data layout. I have
search the Microsoft knowledge base and the web with no luck. I have got my
code somewhat working but I an having problems with generics. I would like
to see another implementation for additional ideas and possible solutions.
Thanks,
JM Tag: share size Tag: 128275
Any such thing as a single column HashTable?
Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the standard
HashTable, but the value column is a waste since every key has the same
value, "".
Thanks for your advice.
- Joe Geretz - Tag: share size Tag: 128271
Socket problem
I have a very simple little program that connects to our email server to
send out emails. When I compiled it with .VS2003 (net 1.1), it works fine.
with VS2005 (.net 2.0), it hangs on the last ReadInfo
Any suggestions? thanks!
Public Function send2() As String
Dim err As String = ""
soc = ConnectSocket(Server, 25)
Debug.Write(ReadInfo(err) & vbCrLf)
WriteInfo("HELO", Err)
Debug.Write(ReadInfo(err) & vbCrLf)
WriteInfo("MAIL FROM:" & From, err)
Debug.Write(ReadInfo(err) & vbCrLf)
WriteInfo("RCPT TO:" & "RTorcellini@mydomain.com", err)
Debug.Write(ReadInfo(err) & vbCrLf)
WriteInfo("DATA", err)
Debug.Write(ReadInfo(err) & vbCrLf)
WriteInfo("This is a test" & vbCrLf & "." & vbCrLf, err)
Debug.Write(ReadInfo(err) & vbCrLf)
WriteInfo("QUIT", err)
Debug.Write(ReadInfo(err) & vbCrLf) 'CODE HANGS HERE- SEE BELOW
soc.Close()
End Function
Private Function WriteInfo(ByVal Info As String, ByRef err As String) As
String
Dim bytes As Byte()
Dim ASCII As Encoding = Encoding.ASCII
bytes = ASCII.GetBytes(Info & vbCrLf)
soc.Send(bytes, bytes.Length, 0)
End Function
Private Function ReadInfo(ByRef Err As String) As String
Try
Dim bytes As Int32
Dim RecvBytes(256) As Byte
Dim ASCII As Encoding = Encoding.ASCII
bytes = soc.Receive(RecvBytes, RecvBytes.Length, 0) 'HANGS HERE
ON LAST ReadInfo
Return ASCII.GetString(RecvBytes, 0, bytes)
Catch ex As Exception
Err = ex.Message
End Try
End Function Tag: share size Tag: 128266
Another Thread Safety Question
Hypothetical question:
A multi-threaded app has an object with a privately scoped collection (like
ArrayList) that is shared between threads. The model is one thread
creates/reads/writes/updates the collection, and all other threads read the
collection. What are the minimal locks required for thread safety?
Is it safe to only lock access when writing/updating the collection?
Is it overkill to lock access for all access (including shalllow-copy
instance cloning and read-only) in the properties/methods exposed by this
object? Tag: share size Tag: 128264
=?Utf-8?Q?Using_=E2=80=98non_true_type_fonts=E2=80=99_in_d?=
I am in the process of upgrading the old legacy application to dotnet 2005
windows application. This is a graphical windows application with various
shapes and text strings being put on the bitmap and printed. The problem I am
having is, because of the fact that the old legacy system used lots of fonts
with custom widths and weight and since dotnet GDI plus does not allowing
using â??Non standard fontsâ??. I am kind of stuck at this point. I do not know
if any of the below would solve the problem or any other suggestions out
there?
1) Create a font using API to GDI and use the Font generated in the dotnet
environment. But when tried this approach I got the error message â??Only TTF
fonts supportedâ??. So looks like not possible.
2) Create the equivalent TTF fonts for all legacy fonts used and use them
in dotnet application.
3) Create an ActiveX on VB6 which returns the equivalent bitmap with the
required text and use it in my dotnet application.
But not sure what other options I have.
Any suggestions are greatly appreciated Tag: share size Tag: 128252
MsBuild lost some imported namespaces?
Hello,
I have medium-sized solution in VB.NET (70 000 lines). The project
compiles ok under VS2005, without any errors, without any warnings. But
when I compile the same solution under MSBuild (from command line),
strange things happenes.
Compiler executed by MsBuild reports unknown types where it should by
known. After whole day of investigation is have found, that imported
namespaces are randomly "lost".
For example, there is clause Imports System.Windows.Forms in the class
file header. But compiler reports DialogResult as unknown type in the
same file. When I change declaration of DialogResult to
System.Windows.Forms.DialogResult, all is compiled Ok. I must to do
these changes 29x in the project.
My question is why? It is _exactly_ the same project, which compiles ok
in VS2005. The compile line for Vbc.exe is exactly the same (compared
from VS2005 build window and MSBuild log file). The build configuration
is the same. Not every type from System.Windows.Forms is unknown. Nor
System.Windows.Forms is the only one lost, there are similar problems
with some of my namespaces.
Can You help me?
--
---------
Environment: VB.NET, VS2005 Pro, XP Pro/P4 3GHz, 2GB RAM
___________________________________________________
Karel Kral, senior developer
ANETE, s.r.o.
___________________________________________________ Tag: share size Tag: 128250
How to Get the List of AppDomains in a Specific Process?
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01C76C7A.FA0E4E80
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Hi, can anybody tell me if it is possible to detect whether a process =
has some AppDomain(s) hosted, and how to get the list of all the hosted =
AppDomains within that process?
------=_NextPart_000_000A_01C76C7A.FA0E4E80
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.3059" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD><FONT face=3DArial><FONT size=3D2>
<BODY>
<DIV>Hi, can anybody tell me if it is possible to detect whether a =
process=20
has some AppDomain(s) hosted, and how to get the list of all the =
hosted=20
AppDomains within that process?</DIV></BODY></HTML></FONT></FONT>
------=_NextPart_000_000A_01C76C7A.FA0E4E80-- Tag: share size Tag: 128240
How to mount a DVD image file?
I just downloaded the Windows Vista SDK, as .img DVD image file.
Now I would like to use it!
Is it possible to mount it without burning a DVD? Tag: share size Tag: 128234
How to monitor which app window is the foreground window?
Hello, friends,
I need to write an assembly (C#.net 2.0 class library) to monitor all
applications
currently running in a PC. Especially, I need to know which window is the top
one, i.e., catch the event when a window becomes foreground window. Should
I use WndProc() to catch related window messages? (I don't want
to use timer).
Any reference paper or sample source code? Thanks a lot. Tag: share size Tag: 128229
Compact Framework Sockets Question
I don't see a Compact Framework newsgroup so I am just going to post it here.
We are porting a .NET 2.0 program to the compact framework and the
application involves the sending and receiving of multicast packets. We
noticed that even though the property Socket.MulticastLoopback exists in
object browser under "System [Compact Framework]", it complains at compile
time that
'System.Net.Sockets.Socket' does not contain a definition for
'MulticastLoopback'
According to the MSDN documentation online, this property is supported by
the compact framework and we are using the latest service pack of CF2.0.
Any ideas? If this property is indeed not included in the CF, how might we
configure the socket so that (we have already tried
sock.SetSocketOption(SocketOptionLevel.IPv4,
SocketOptionName.MulticastLoopback, 1);
which throws during runtime) we can allow multicast packets to loop back? Tag: share size Tag: 128224
How to know if something is thread safe?
I'm working on a routine that get's information from an html page. I'm using
the IHTMLDocument2 type and want to know if it's thread safe? How can I
found out if it is? I want to set up a couple of threads that will process
my web pages.
TIA - Jeff. Tag: share size Tag: 128219
C# CSharp Reset Struct Class Memory
C# CSharp Reset Struct Class Memory
Hi,
I have a class, cerated like a struc for some reasons, and I want to
reset all values in it.
public class MyClass
{
public byte Channel;
public byte SatelliteID;
public byte SyncFlags;
public byte PhaseErrorCount;
}
After filling the class with some values, I want to reset all values
to the default, like the first time it was created.
I can do this filling every parameter, but I have some classes with a
lot of parameteres.
there is a way to reset this class? For example clear the memory
occupied by the class.
I know that I can make assigning a NULL to the class and recreate it,
but I search another way.
THank you very much Tag: share size Tag: 128215
Problem calling XML (non-SOAP) web service with C#
I am trying to call an XML (non-SOAP) web service with C#.
I was provided with a request schema by our web services team, and I
generated a CLR class for it using XSD.exe.
When I instantiate this schema class and try to set a property on it,
however, I get the following error:
Object reference not set to an instance of an object.
This is essentially the code that's causing the error:
MyRequestSchema request = new MyRequestSchema();
MyRequestSchema.FirstName = "Jonathan";
Any idea what I'm doing wrong?
Thanks,
Jonathan Tag: share size Tag: 128212