|
Thanks for your answer ! I'll have a look on what I can do with Orca !
I wish you a nice day,
alain costanza
There is no way to happiness, happiness is the way !
|
|
|
|
|
Hi All,
I've been working on a saved dynamic assembly that holds all the types and corresponding xml serialization attributes I need to deserialize xml documents into objects.
You might wonder why I would choose a dynamic assembly over simply coding the types at compile time - the simple answer is I don't know what the types will be before hand and I only have an xml schema (from which I build the dynamic assembly) with various attributes that change frequently.
Since the schema only defines data types (methods,events,delegates could probably be defined within xs:appinfo tags but in my case they are not), I needed a way to add functionality to these dynamically created classes which were otherwise, nothing more than just data stubs.
The method I chose was to define (at compile-time) abstract base classes from which classes in my dynamic assembly could inherit. Now these simple data-stub classes had a complement of methods to enable them to do more than simply hold data in fields.
Unfortunately, it seems that since my dynamic classes now inherit from classes defined at compile-time, the xml serializer gets confused (see error and stack trace below).
It worked fine before I added the inheritance - maybe I need a reference (somehow) to the hardcoded assembly containing the types I inherit from in my dynamic assembly.
Any suggestions? Thanks in advance, Rein
[[error and stack trace]]
"An unhandled exception of type 'SystemIO.FileNotFoundException' occurred in mscorlib.dll.
Addtional Information: File or assembly name [xxxxx.dll], or one of it's dependencies, was not found."
stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.Xml.Serialization.Compiler.Compile()
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings)
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlTypeMapping xmlTypeMapping)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
|
|
|
|
|
|
Hello,
I did the below experiment and I did not understand the cause for the exception. Can you please throw some light on this problem?
Also can you please clarify whether a native client can directly sink the .NET Remoting callbacks?
Description of Prototype:
This has mainly 3 modules viz. Remoting Server(C#), Adapter (MC++) and Client(Native C++).
(1) I implemented a SAO(Server Activated Object) singleton, in a C# .NET Remoting Server. Remoting object exposes ISrv interface. Also, Remoting object sends notifications via ISrc interface. These interfaces are defined in a C# Class library and shared across Client, Adapter and Server.
(2) I implemented an MC++ Adapter, a wrapper for the SAO. Adapter implements ISrv interface and exposes the same to native client(s). This basically holds a transparent proxy to the remoting object mentioned in (1).
(3) I implemented a native C++ client interacting with SAO via MC++ Adapter. Client was able to reach SAO via MC++ adapter using ISrv interface. Also Native client was able to receive notifications from C# SAO via sink class(on Cleint side). Actually the sink objects were registered onto SAO by clients via ISrv. SAO Singleton maintains such registered sink objects in an arraylist in its class scope. For some reason, I observed an exception when Server tries to send notifications, 5 minutes(approximately) after the sink object registration. I could not understand the reason for this problem. Can you please clarify? Below is the exception info:
Exception Message: "Requested service not found"
Exception Source: System.Runtime.Remoting.RemotingException
To get around this problem, I had to do the below changes to Adapter & Client modules:
I created a Sink class, derived from MBR and implementing ISrc in MC++ Adapter. Set the lifetime of Sink class to indefinite life time. Then Adapter was able to receive notifications from SAO without any problems as described above. In this experiment, I had to use a different interface between native client and Adapter for Adapter to relay SAO notifications back to the client.
Thank you in advance....
Best Regards,
|
|
|
|
|
chervu wrote: Exception Message: "Requested service not found"
Exception Source: System.Runtime.Remoting.RemotingException
To get around this problem, I had to do the below changes to Adapter & Client modules:
That happened because in .NET Remoting, each remote object has a definite lifetime associated with it. This is to avoid leaving them hanging around forever.
Now because you overrode InitializeLifetimeServices and returned null, the remoting framework doesn't disconnect the object from the framework, in other words, the object will be accessible for the lifetime of the server. For more advanced lifetime control, have a look at the ISponsor[^] interface.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thank you very much for the response.
Is it correct to say that native clients(in above experiment: C++ exe) can not directly receive notifications from a Remoting Server (in above experiment: SAO)?
If this is correct to say, then always a managed Adapter(wrapper) needs to be written to receive notifications from a remoting server so as to relay them to native clients?
I did not understand how Remoting Server can lose instances of Sink objects created/existing in the Native exe over heap. Can you please give a pointer on this topic to any book/MSDN article that explains a little detailed?
Thanks again & Best Regards,
|
|
|
|
|
chervu wrote: Is it correct to say that native clients(in above experiment: C++ exe) can not directly receive notifications from a Remoting Server (in above experiment: SAO)?
Yes, because remoting only works across clients written in .NET.
chervu wrote: I did not understand how Remoting Server can lose instances of Sink objects created/existing in the Native exe over heap. Can you please give a pointer on this topic to any book/MSDN article that explains a little detailed?
Your remoting server didn't lose instances of native objects, it destroyed your managed wrappers because their lifetime expired.
This[^] might help. The "Advanced .NET Remoting" book by Ingo Rammer might also help.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello,
I'm facing an interesting problem. I'm developping a .NET C++ DLL which mainly exposes a __gc class that the user can instantiate in its application. He can create many instances if he likes to.
I would like to refresh every instances of the class when this DLL gets a message queued by a C driver.
I would also like that any instance of the class that is no more used by the user is GC'ed.
The problem is that listening to the C driver messages prevents the garbage collector to remove the unused classes.
I tried to use delegates, static events, WIN32 events.
I think that I could succeed if I reference the instances of the classes in an unmanaged code, which will be in charge of listening to the messages. Is it the right way?
Jean-Luc
|
|
|
|
|
|
I am writing a C# app which accesses the list of processes using Process.GetProcesses(). However I was very puzzled when I studied the Process class to discover that it has no method or property pertaining to the user that is running the process. Surely, under XP at least, all processes must have an associated user. Certainly Task Manager lists the user with each processes. Can anyone tell me how, having got the Process object, I then find out which user it is running under?
Dave
|
|
|
|
|
If you know the Win32 API function to retrieve that information, you can always P/Invoke it and pass theHandle[^] property as the HANDLE parameter.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Well, if that's the only way . . .
Actually I don't know the API call either - anybody help?
Dave
|
|
|
|
|
Hi,
I have to generate message digest using SHA1 algorithm to produce 160 bit number. Then message digest is encrypted with signer's private key(using RSA ECB and PKCS#1 v1.5 padding) and convert to printable hex format.
For the above specification i have tried the following code, I am getting Invalid PKCS#1 padding: no leading zero error (java.security.SignatureException, javax.crypto.BadPaddingException on the receiver end. They are using Java interface to handle these messages.
Is there any other method to create ECB and PKCS#1 v1.5 padding using .NET ?
Imports System.Security
Imports System.Security.Cryptography
Imports Microsoft.Web.Services.Security
Imports Microsoft.Web.Services.Security.X509
Public Function fnDigitalSign1(ByVal strMessage As String) As String
Dim rsaCSP As New System.Security.Cryptography.RSACryptoServiceProvider
Dim toEncrypt() As Byte
Dim encrypted() As Byte
Dim digest() As Byte
Dim enc As New UnicodeEncoding
toEncrypt = enc.GetBytes(strMessage)
'compute hash with algorithm specified as here we have SHA1
Dim sha1Algo As New SHA1Managed
digest = sha1Algo.ComputeHash(toEncrypt)
Dim cert As X509Certificate = fnGetCertificate()
'Here i am getting correct certificate only.
If cert.SupportsDigitalSignature() Then
Dim objRSA As RSAPKCS1SignatureFormatter
objRSA = New RSAPKCS1SignatureFormatter(cert.Key)
objRSA.SetHashAlgorithm("SHA1")
encrypted = objRSA.CreateSignature(digest)
End If
Dim strHEX As String = getHEXformat(encrypted)
End Function
Private Function fnGetCertificate() As X509Certificate
Dim store As X509CertificateStore
store = X509CertificateStore.CurrentUserStore(X509CertificateStore.MyStore)
store.OpenRead()
Dim cert As X509Certificate = store.Certificates(0)
Return cert
End Function
Private Function getHEXformat(ByVal encrypted() As Byte) As String
Dim b As Byte
Dim hexString As String
For Each b In encrypted
hexString += String.Format("{0:X2}", b)
Next
Return hexString.ToLower
End Function
'And I am trying with RSACryptoService provider also
Public Function fnDigitalSign2(ByVal strMessage As String) As String
Try
Dim cert As X509Certificate = fnGetCertificate()
'Receiver's Public
Dim receiver_public As RSAParameters = cert.Key.ExportParameters(False)
Dim sender_private As RSAParameters = cert.Key.ExportParameters(True)
Dim toEncrypt() As Byte
Dim encrypted() As Byte
Dim cipher() As Byte
Dim digest() As Byte
toEncrypt = fnGetEncodedBytes(strMessage, SelectEncode.ASCII)
'compute hash with algorithm specified as here we have SHA1
digest = fnComputeSHA1Hash(toEncrypt)
Dim rsaCSP As New System.Security.Cryptography.RSACryptoServiceProvider
rsaCSP.ImportParameters(sender_private)
cipher = rsaCSP.Encrypt(digest, False) 'False to create PKCS#1 padding
Return getHEXformat(cipher)
Catch ex As Exception
End Try
End Function
dhanasekar
|
|
|
|
|
Hi all,
I just stumbled upon WPF(Windows Presentation Foundation) and couldn't actually understand the whole thing about it. I wanted to ask if this is the preferred way of writing GUIs for Vista onwards(kind of replacement of SWF?)?
Thanks
|
|
|
|
|
Hi all,
I developed windows form application using VC++.NET.
I have a check box that i need to know its status from another file. I can access it from the class file (using its name or this pointer) but i can't access it from another file within the project.
How can i do it?
I tried using the class namespace but no good.
Please help.
10'x
|
|
|
|
|
Hi,
Now that we have the final version of VS.NET 2005, my question is can we have VS.NET 2005 installed and safely working along-side VS.NET 2003 that I already have (which is my current production environment)? Has anybody had a rough experience in doing this?
I want to develop some projects in VS.NET 2005 and keep developing some projects in VS.NET 2003. To do this i will need to install both the environments (and the relevant Framework version as well) together in the same production environment.
Is it safe to do this - or should i use the Virutal PC to install VS.NET 2005?
Note: I have the final VS.NET 2005 version (production reelase, not the Betas or RCs), since I am an Universal MSDN subscriber.
Thanks.
|
|
|
|
|
Many here have been happily using the Beta versions without problems. So, in theory, the release version should be even safer. However, if in doubt, install it on Virtual PC or, alternatively, wait a few weeks to see what problems/bugs the early users have reported. (An idea could be to install both VS 2003 and 2005 on VPC to test out the co-existence.)
I myself have not tried VS 2005 yet, but will probably do so in the new year.
Kevin
|
|
|
|
|
We have an app close to beta. It's a multi tier app with the business logic in business objects with a separate UI above that. We're exposing the business layer assembly as a developers API.
My question is this: I don't want developers to have access to a limited set of methods in the business layer .dll, I could mark them internal or private but then I can't access them from our own UI assembly which needs them.
It's not secrets or anything, we don't need to hide them, it's just complex objects that we don't want to give access to the developer because they are fairly intimately tied to the UI layer and not for general consumption and we don't want people to be able to screw with them and mess up the data.
How do I expose certain methods in the biz object layer for my UI layer (an executable in another assembly), but prevent access from developers creating their own apps using the biz object assembly?
I can of course flag them as nonbrowsable etc attributes, but that doesn't really solve the problem in any meaningful way.
Since they are all strong named assemblies I'm theorizing that there might be some way of preventing access to specific methods from assemblies that don't contain this strong name, or perhaps constructing a separate assembly specifically for the purpose of being the developers api that in turn calls mirrored methods in the biz object layer or...??
"Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!"
-Edward Tattsyrup
|
|
|
|
|
Train free @Microsoft
Got to this link and register free for
training your self for VS2005
https://www.microsoftelearning.com/visualstudio2005/
or
http://www.financialexpress.com/latest_full_story.php?content_id=107645
Microsoft dont give anything free except training
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
hello all,
how do u do?. how can i get the parents variable info from child form.
i used this->Owner->Text. its giving only the parents text. but i want a variable from the parent.
for Example, i have m_TestVar in parent form, and is assigned to "Hello.. child". how do i get this variable from child form. This variable is declared as Public in parent form.
Thanking u in advance.
Basheer
|
|
|
|
|
You can cast this->Owner to your class. Like this
class YourForm : Form
{
public string m_TestVar;
}
class ChildForm : Form
{
void SomeMethod()
{
YourForm f = (YourForm)this.Owner;
Console.WriteLine(f.m_TestVar);
}
}
This may or may not be a good idea, as it means that ChildForm can be used *only* in conjunction with YourForm. It would be better if you could pass the value of m_TestVar to ChildForm, as a method parameter, for example.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hi Mr.Senthil,
how do u do?. Thank u very much for ur reply. well here whatever u said is ok. But the prob is this is not possible in case Winforms i have some prob. coz compiler never knows what is the parent form for it at compile time. i hope if u see the code fragment u can understand the prob.
in parent form:::
public:
ChldForm *child;
String* info;
System::Void Form1_Click(.......) {
info="Check Application";
child=new ChldForm();
child->ShowDialog(this);
}
System::Void timer1_tick(....) {
/// the info value changes for each 2 minutes
info=......;
}
in child form i am using this to call.
this->Owner->info;
but the problem is that compiler cant guess who is the parent here. so i used the type cast for this.
((parent*)this->Owner)->info
But it says that the parent is not the member of the present namespace. How do i solve this.
i got a solution for this. But this is not optimized.
thank u for ur reply once again.
regards,
Basheer.
|
|
|
|
|
Think about it the other way around, put a public property in your child form that is set by the parent form when the child form is constructed. The property could reference whatever you like, so let's say you have a text box in your parent form, you can have a public property in your child form like this:
private TextBox _parentTextBox=null;<br />
public TextBox ParentTextBox<br />
{<br />
set{ _parentTextBox=value;}<br />
}
When you create your child from from your parent form, set it's "ParentTextBox" property to your parent forms corresponding text box and you now have full access to it.
Of course it doesn't have to be a text box, it could be any object in your parent form and it doesn't have to be a property, you could just make it a parameter in the constructor of your child form depending on how required or not it is.
This is much clearer and more portable than trying to cast the parent form to gain access to it and easier to ensure there are no problems down the road with changes etc.
"Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!"
-Edward Tattsyrup
|
|
|
|
|
hello,
thank u very much for ur reply. i did the same and got the solution. Thank u once again
|
|
|
|
|
On a web page from Microsoft I discovede that .Net 1.1 SDK cannot be installed on a 64 bit processor(http://msdn.microsoft.com/netframework/technologyinfo/sysreqs/default.aspx[^]), but on the main download page it is not mentioned.
Can enybody confirm that on an 64 bit architecture the sdk can not be installed (or it doesn't work)?
I hope we understand...because is a rough world out there...
|
|
|
|
|