I have implemented something just like this for my company. I can't give you the code but I can generically describe what I did.
Each plug-in can be a seperate Class Library project. You'll want to create an Interface in another class library project that all plug-in projects can reference. Insert a class into each plug-in class library that implements the interface you created.
When the .exe starts up, it can loop through all the dlls in it's executing directory and check to see if any of the classes (types) in a dll implement the interface you created. If so, you can use reflection to create an instance of that class (type) at runtime and call the appropriate interface methods to "start" that plug-in.
I changed my configuration settings (-> Seetings, Control Panel, Adminstrative Tools, Microsoft .NET Framework 1.1 Configuration) because I wanted to execute a C# application from another server. So I declared this server to be a trusted source and then tried to start it. But I got an error message: "Eine Ausnahme 'System.Security.Policy.PolicyException' ist in BUNeu.exe aufgetreten".
If I try to open one of my projects on the laptop then the project is opened, but the sandclock ist running.
If I try to create a new project I get the error message: "execution permission cannot be acquired".
If I try to change the configuration settings I get the error message:
"Snap in failed to initialize.
Name: .NET Framework 1.1 Configuration
So I can't do anything now. Does anyone can help me with this problem?
I am developing an application with several validation controls on the screen and the controls are working properly. On the screen I have an OK button, which causes control validation to occur, I also have a CLEAR button, incase the user wants to start over and blank everything out. When the user presses CLEAR, all the fields are set back to their default, "" in many cases. The CLEAR button is causing validation to occur and the user ends up with a bunch of messages saying that these fields can not be blank, in the ValidationSummary control.
The way I have the validation controls setup is to display an * next to the field in error and display the actual message in the Validation Summary.
I tried setting ShowMessages in the validation summary to false, but the * still show up next to the fields. Any idea how to turn off all validation if the CLEAR button is pressed?
Ok, in no way am I a N00b at reading files! However, I was debugging some code today in which I was using a IO.StreamReader to read the text from a file and using an IO.StreamWriter to write it into a different file.
This file is about 3.2MB. The StreamReader DOES return the Correct Length of the File (IO.StreamReader.BaseStream.Length). HOWEVER, while reading the file, the Stream THINKS it has reached the end, and like a good little programmer, I Flush the StreamWriter (BTW, I am flushing every 8096 Bytes - yes, that IS a lot of water!) but I am missing a HUGE chunk of data at the End of my file!
I have noticed that the IO.StreamReader.BaseStream.Position is usually TOTALLY different than the Sum of the Bytes returned for each re-iteration of retrieving data. For example, reading in 8096 Bytes at a time, when my Position variable thinks it's at 16,192, the BaseStream has it's internal buffer set to some other amount... Is this what's messing it up?
Notice however, it I REALLY want to waste a lot of memory and processing time, I can just read it all in at once (IO.StreamReader.ReadToEnd) and then process it....GreeeEEEAAAaaaat!!! Just what I want! NOT!!!
So...what the @%$* is going on!??? How do I read the rest of the data!???
Wait a tick, it gets even better! I just discovered that it's Reading past the end of the File and returning more data than it should!
So, I know I need to use this handy-dandy Routine MS gave us: IO.StreamReader.DiscardBufferedData(). Soo, anyone have a clue as to how this should be done?? Any examples? Becuase the Help doesn't...well, help!
Ok, I found the answer to this. I'm sure most of you do not need this functionality and only use "ReadLine"... However, try parsing ANSI 835 files . (Yes, I'm aware there are 3rd party Libraries for this, but I hate them)
'Function to Read a File into Cache so RegEx can be Performed
Private Sub CacheFile(ByVal File As String)
Dim ioReader As IO.StreamReader
Dim vBuffer() As Char
Dim hResult As Integer
'Exit if the File does not exist
If (File = "") Then Return
If (Not IO.File.Exists(File)) Then Return
If (Me._File <> File) Then Me._File = File Else Return
'Initialize the Cache
_Cache = Nothing : _Cache = New System.Text.StringBuilder(8096)
'Read the File
ioReader = New IO.StreamReader(File, System.Text.Encoding.UTF8, True, 8096)
hResult = ioReader.Read(vBuffer, 0, vBuffer.Length) 'Read More Data
While (hResult > 0)
'There is a bug with a StreamReader. Sometimes more data is read than is neccessary.
'If these are the Last Bytes of data, only read up to the hResult
If (hResult < vBuffer.Length) Then _Cache.Append(vBuffer, 0, hResult) Else _Cache.Append(vBuffer, 0, vBuffer.Length)
hResult = ioReader.Read(vBuffer, 0, vBuffer.Length) 'Read More Data
Catch ex As Exception : MsgBox(ex.ToString)
If (Not IsNothing(ioReader)) Then ioReader.Close() : ioReader = Nothing
i want to install visual studio .net, but i have a problem, i can`t install ie service pack, i don`t have connection to the internet. is it really true that u need to connect to internet. i`m running the update, copying from a friend. thanks
System requirements for VS.NET, full page here: http://msdn.microsoft.com/vstudio/productinfo/sysreqs/default.aspx[^]
Visual Studio .NET 2003 can be installed onto any of the following systems:
Microsoft Windows® Server 2003
Windows XP Professional
Windows XP Home Edition¹
Windows XP Media Center Edition
Windows XP Tablet PC Edition
Windows 2000 Professional (SP3 or later required for installation)
Windows 2000 Server (SP3 or later required for installation)
The install can update some packages from the Internet, but it is not required.
I've been programming in .NET for over two and a half months now. And at this point i've come to the conclusion that i doubt .NET more than i doubt myself. IMHO a pretty dangerous situation. Back in mfc-days i used to spend two days on a problem before turning to internet to see if a MFC bug was involved. Now, in .NET, i turn to internet to see what bugs i can expect before i even put as little as a textbox on a form. Is this normal??
I absolutely adore C#. No doubt. And I must admit that .NET can be an incredibly powerful platform. Moreover, i'm convinced that it once WILL be. So, i will try to hang on to it as long as possible. But then again... boy... am i glad i skipped version 1.0!
Please tell me i'm wrong!
Ok, a few examples:
- A textbox without a border cuts off the lower parts of characters like y, p and g. Mainly in fontsize 11 with AutoSize turned ON.
- Listviews don't display item images when put on a usercontrol in a usercontrol. And the headers have serious painting errors.
- Listboxes don't always fire their click events.
- Tabpages cannot be disabled or hidden.
- When i move a project to another location, i always do a complete rebuild. Of the project itself and of any other projects involved. Compiles with no errors. Two weeks later, for no apparent reason, the program crashes on the exception that there are no appropriate resources compiled into the control. Rebuild all... no errors! Run it... and crash!!
- Every now and then controls dissapear from the designer. Takes a few rebuilds and IDE restarts to get them back on... most of the time... yet not always.
- I need a virtual listview... nope. The solution? Unwrap the .NET control piece by piece until it is stripped to the bare Win32 control and use the API and messages like we used to. Only... this time lookup the old header files to get all the constants, change "defines" into "const int", don't forget the WndProc and spend another hour packing all the structs into the right marshalling format. ALL my controls have at least two platform invokes!! And this is the only solution that is proposed over and over again. Everywhere you look for answers, they always boil down to "strip the .NET part and start programming like you used to...". But is that a future-stable solution?
- Some scrollbars are XP, while others stay Win95. Or was that Win3.11? And scrollbars tend to lie if you ask them if they are visible or not.
- A simple picturebox has no scrollbars!!
- When i start my old MFC software, ALL the controls and dialogs obey to the XP themes and colours. But not my .NET application!!?? I know, i know...
I DO that! Nevertheless, textbox backgrounds fail, and some dialogs too! While the least i had expected was to have visual consistency!
And these are only a few among many.
.NET is supposed to be the platform that rockets you into writing stable and gui-intensive software. Well... maybe... once it's debugged.
Ok, i'll stop nagging. Just please, tell me i'm wrong!
Thanx for bearing with me
University of Antwerp
I think you have some valid complaints, I have some similar. However, .NET has really evolved programming in terms of having a really nice library (BCL) and OOP friendly way to design/develop n-tier applications.
I would bet that Microsoft will address many bugs/issues in future releases.
Yes, that's true. .NET is a giant step in the good direction. When i wrote my complaint message i just had a terrible "buggy" and frustrating evening and felt the need to ventilate. Thanx for your reply!
Happy coding too,
University of Antwerp
I'm creating a prototype and have a simple control that I've derived from System.Windows.Forms.UserControl. I intend to be able to use this control in both a windows form client as well as to imbed it in a web page.
In order to get data into the control, I'm opening a tcp connection to my app server and requesting data, I am very familiar with tcp and have no problems there. Everything is working perfectly when I put the control into a windows form app.
My issue comes up when I plug the control into a web page. Now, I have configured the .NET CAS properly to grant appropriate permissions to the code using strong name evidence so I don't think I have a security problem with CAS.
But, I send in the tcp request from the web page, I am able to connect (I see the syn - syn/ack - ack in my sniffer) but then several requests are issued from my host to NETLOGON and some to port 445 (Microsoft directory services). Eventually (over 90 seconds later), my request completes (with my host sending psh-ack and getting fin-psh-ack) as expected. I just can't understand why the control is querying port 445 or what is going on. I don't see why my request is taking 90+ seconds from the time my connection opens until my request goes to the server...??
Any of you run across this before or have any suggestions?
the Windows Service Manager provides some recovery options. In the properties of a service, you can select the computer's response if the service fails. For example, First failure >> Restart the Service. How can I announce the Windows Service Manager, that my own service fails, so that the recovery options start the work? Has anyone a code example?