|
Look at my post regarding exactly how to do this, a few posts down (i think yesterday or the day before), on how to use StackTrace. From there u can get the MethodBase just as you want it, but be warned, it will likely be much slower than passing MethodBase.Current. Anyways, I dont find anything wrong with your approach as long as you keep those ugly ones private!
top secret xacc-ide 0.0.1
|
|
|
|
|
Thanks for your reply, I'll look into your suggestion.
I don't see anything wrong with it either other than I'm lazy and don't want to have to create the methodbase object from each of the methods that calls that particular method, I'd rather have the called method figure it out.
Again, thanks for your help.
|
|
|
|
|
Hi Friends
I have a console application that produce assembly in .EXE. This app has some dependency assemblies which it reference in the project.
Now i want to give my client only the .EXE file. So i want to statically link the dependency assemblies in this .EXE .
The Assembly Linker tool(al.exe) only links the modules or the resource files.
Any pointer and idea is most welcome.
Thanx a lot
Naveen
|
|
|
|
|
Static linking is not supported by the .NET framework. True, you can combined a few assemblies, but its purely a hack, not static linking in the true sense. .NET is designed around dynamic assemblies that are self-describing.
top secret xacc-ide 0.0.1
|
|
|
|
|
hi leppie
Thanx for info.
Yes my main requirement is to combine few assemblies into one main assembly(.EXE) nad just give my client the .EXE file.
If you the solution or any idea ,please do let me know
Thanx a lot
Naveen
|
|
|
|
|
softp_vc wrote:
Yes my main requirement is to combine few assemblies into one main assembly
I am curious. Why? What is wrong with distributing a few assemblies? If this was really an important requirement why didn't you build it as one exe in the first place?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Hi
you are right at your place.
But right now my concern is to link the dependent assembly into the main assembly file.
Hope any body would be having the idea for this
Regards,
Naveen
|
|
|
|
|
I don't think you understand: it isn't supported. And if you're referring to the .NET base class library assemblies (mscorlib.dll, System.dll, etc.), then I'm guessing you also don't want the client to have the .NET Framework installed, huh? Guess what - that's not possible, either. The .NET Framework is more than just .NET assemblies - it's a complete runtime made up of system components and must be installed.
There is a project somewhere on the web that attempts to circumvent this, but all it really does is collect only the required components of .NET for a particular application and install them locally into a directory. It's still the .NET Framework, just a hack and not installed as system components, thus bloating the system.
Just like Java requires a JVM and VB6 and lower requires a VB VM (virtual machine), .NET requires the CLR.
Colin is right, though: if the dependent assemblies are ones you created, then don't create dependent assemblies and create all the code into one .EXE assembly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi friends
Thanx very much for giving me such a useful info and having a discussion with me.
I look forward for such a discussion in future
Thanx again
Naveen
|
|
|
|
|
IF set the visual style using Application.EnableVisualStyles(),so
the image in ListView can not be displayed. How to display the image
in ListView in XP visual Style?
Colin
|
|
|
|
|
Never seen that! You should call Application.EnableVisualStyles() only once, followed by Application.DoEvents() (this fixes a bug) as the very 1st 2 lines in Main().
top secret xacc-ide 0.0.1
|
|
|
|
|
You are right, Thank you !
|
|
|
|
|
leppie wrote:
You should call Application.EnableVisualStyles() only once, followed by Application.DoEvents() (this fixes a bug) as the very 1st 2 lines in Main().
Where were you when i needed to know that?
I pulled out lot of hair trying to find answer to that, guess that teaches me to try to find you guys as the first resort!
"Creating tomorrow's legacy systems today.....
.... One CRISIS at a time!" -- Unknown
"If you build it....
.....BUGS will come!" -JB
this.Dispose();
"A Bug is a piece of <sup> code </sup> that knows whatz its purpose"
|
|
|
|
|
In my win app,i embed a webbrowser control axWebBrowser1,after has loaded a page ,no matter what sentence below was executed:
((IHTMLDocument2)axWebBrowser1.Document).designMode="On";
or
((IHTMLDocument2)axWebBrowser1.Document).designMode="Off";
the browser's IHTMLElementCollection.Lenght will became to 0:
HTMLDocument doc=(HTMLDocument)axWebBrowser1.Document;
((IHTMLElementCollection)(((mshtml.HTMLDocumentClass)(doc)).all)).length<--=0
why?
|
|
|
|
|
I need to make a control, I think. All I need is a multi column list, with transparent background, which does not show a scroll bar, instead scrolling in response to function calls. If it could also associate a value with a row, and return that value instead/as well as the displayed data, I'd be in heaven. Know ye of such a beast ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Deriving from listbox, and using owner draw would be sufficient. Also enable the AllowTransparentBackground style with SetStyle().
top secret xacc-ide 0.0.1
|
|
|
|
|
Thanks - I actually ended up creating a control from scratch in the end Thanks for the SetStyle tip though, I definately needed to know that...
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
hello,
I have developed a web service. The server (web service)serializes an object (a struct) via BinaryFormatter and then returns it to the client.
The client receives the serializated object and tries to deserialize it. This throws the following exception:
System.Runtime.Serialization.SerializationException:
Bynary stream does not contain a valid BinaryHeader, 0 possible causes, invalid stream or object version change between serialization and deserialization.
Here is the code:
serialization:
<br />
MemoryStream ms = new MemoryStream();<br />
BinaryFormatter bf = new BinaryFormatter();<br />
bf.Serialize(ms,myStruct);<br />
byte[] bArray = ms.GetBuffer();<br />
ms.Close();<br />
deserialization:
<br />
MemoryStream ms = new MemoryStream(bArray);<br />
BinaryFormatter bf =new BinaryFormatter();<br />
ms.Position = 0;<br />
myStruct struct =(myStruct)bf.Deserialize(ms);<br />
ms.Close();<br />
Do you know what is happening?
thank you.
|
|
|
|
|
It appears you have an assembly version mismatch.
Resolution:
Create a seperate assembly u can both reference from the service and the client (i tend to like give that a fixed version number, not the auto one).
Another problem u could have, that I have seen, is closing a MemoryStream after putting an image thru, causes problems, not sure if this a bug or not, as calling Dispose via an implicit interface call infact works.
top secret xacc-ide 0.0.1
|
|
|
|
|
hello,
"Create a seperate assembly u can both reference from the service and the client (i tend to like give that a fixed version number, not the auto one)."
Could you give me a reference (article, tutorial, book...) to learn how to do it?
Thank you.
|
|
|
|
|
This is basic. Create another assembly that defines the type. Both the client and server project depend on this assembly and use the type defined in that shared assembly.
As far as fixing the version number, go to your AssemblyInfo.cs file and change the AssemblyVersionAttibute value to something fixed (no asterisk - *). If you use an asterisk, the assembly version is automatically generated based on the documentation for the AssemblyVersionAttribute in the .NET Framework SDK. This is a terrible feature that wasn't meant to be in the .NET Framework originally, or so I hear.
.NET assemblies link against versions of other assemblies. Changing the version breaks this linkage, but there are ways to redirect assembly versions. Read Redirecting Assembly Versions[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hello,
I think I have found what is the problem... but I do not know the solution.
The problem is that I am using CAPICOM.SignedData. The process is as follows:
1.- Serialize the struct.
2.- Convert the byte array into a string via System.Text.Encoding.UTF8.GetString() method.
3.- sign the data (the string) with SignedData.sign() method and return the result (a string with a PKCS#7 structure) to the client.
4.- The client verifies the signed data and extracts the SignedData content (a string) which is the serialized struct.
5.- Finally, the client tries to deserialize the struct and it throws the exception.
I think the problem is the SignedData operations because without them I can serialize and deserialize the structs without any problem.
Any suggestions?
thank you.
|
|
|
|
|
hello,
i have solved partially my problem:
-- The problem with the signedData was the conversion from byte array to string: i was converting the byte array (the serialized object) into a UTF8 string instead an Unicode string. So, the solution was to use "System.Text.Encoding.Unicode.GetString()"
-- but now, I have another problem. When the client tries to deserialize the struct it gets the following message exception:
System.IO.FileNotFoundException: File or assembly name WEBSERVICE, or one of its dependencies, was not found.
I have develop a testing Console Application that serializes an object, signs it and verifies it with SignedData, and finally, deserializes it and it works well. So, I think it is a WebServices problem.
It sounds like client can not find the serialized object class or the namespace where it is contained but this is rare for me because the client can instanciate that class.
thank you one more time
|
|
|
|
|
Hi,
I am using C#, in my application main class contained object of another class but I need to call main class function in the contained class but I am unable to call main class(container class) function in contained class and I am unable to set reference of container class in contained class because it Viusal studio gives error "Circular Dependency".
Suggust me solution I can access container class function from contained class.
Thanks.
|
|
|
|
|