|
Hello
Help me Please!!
the problem occur when :
first i run my chat program and it's working well , but when i get out of my program
at log back in im getting this error at the server When he try to invoke me some event:
{"Found two different objects associated with the same URI, '/999013af_72e3_42b1_affa_43766d7f541f/Chat'."}
i just dont know what to do :S
here is the client side app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="IskaMessengerCommanObject.RemotableObejct, IskaMessengerCommanObject"
url="http://XXXX:7717/Chat"
/>
</client>
<channels>
<channel
ref="http"
port="0"
>
<clientProviders>
<formatter ref="soap" />
</clientProviders>
<serverProviders>
<formatter ref="soap" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
and this is the instance im running from client
RemotingConfiguration.Configure("c:\\Hafaka\\IskaMessengerUser.exe.config", false);
RemotableObejct RemoteObject = (RemotableObejct)Activator.GetObject(typeof(RemotableObejct), "http://xxxxxxxxxx:7717/Chat");
<div class="ForumMod">modified on Friday, May 22, 2009 3:47 AM</div>
|
|
|
|
|
Hi all,
I keep getting the following error message:
<br />
System.InvalidOperationException: Collection was modified; enumeration operation may not execute. <br />
at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext() <br />
at System.Windows.Forms.Application.ExitInternal() <br />
at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t) <br />
at System.Windows.Forms.Control.WndProcException(Exception e) <br />
at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e) <br />
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) <br />
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) <br />
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) <br />
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) <br />
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) <br />
at System.Windows.Forms.Application.Run(Form mainForm) <br />
at BlueBroadcaster_Ultimate.ProgramClass.Main(String[] args)<br />
does anybody know what this means or where it could be originating from?
BlueBroadcaster
|
|
|
|
|
Actually, it's not crazy. It's probably something like :-
foreach (Object obj in myCollection)
{
myCollection.Add(anotherobj);
}
and it's telling you that you can't add / remove / clear or whatever in the collection you're iterating over.
If you only ever want to add new items, you can use a "for (int loop=0; loop<myCollection.Count; ++loop)", although that will iterate over the new items as well.
Otherwise, create "Add" and "Remove" lists which can be processed after the main loop to add and remove as needed.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Sounds like Items was removed from your list before the line that causes error.
hope usefull.
sorry for bad english.
|
|
|
|
|
Basically, you cannot alter a collection of items as you ForEach over it. You can make changes to the items inside the collection, but you cannot add or delete items to the collection itself.
|
|
|
|
|
Dave Kreskowiak wrote: you cannot alter a collection of items as you ForEach over it
why does this happen?
|
|
|
|
|
I guess because the framework is keeping track of where you are in the collection, which assumes the collection will not change. If it does, what should foreach do ? you may have removed an item, how do you know if it has been iterated over ? Would you want it to be ? Easier just to say 'don't change this while I am working on it'. I suspect there's a more concrete reason than that, if you look into how it's implimented, but it seems obvious to me that it would create some situations where you could not predict the behaviour of foreach if you could alter the collection.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hello,
I am writing a program that will be used in Labview (think of it as a scripting enviroment for those who do not know). I have about 30 dlls that are working together, some .net and some unmanaged. So I have a control in the labview that when it is run, the executable location becomes labview.exe in the national instruments folder. So the top dll is called, and then searches in the national instruments folder.
Then none of the other .net dlls can be called, because they are in the original folder.
So I want to tell the system where to search for my dlls. I found information about the config file and have been trying <probing> and <codebase> and nothing is working. Can you tell me what is wrong with my config file.
Thank you.
<code><?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="C:\Documents and Settings\admin\Desktop\csharp_core\bin\Debug\SubPlugs\" />
<dependentAssembly>
<assemblyIdentity name="PaintDotNet.Core" publicKeyToken="null" culture="neutral" />
<codeBase version="3.36.3426.17484" href="C:\Documents and Settings\admin\Desktop\csharp_core\bin\Debug\SubPlugs\PaintDotNet.Core.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
|
|
|
|
|
The privatePath is relative to the application's base directory and must be a subdirectory of the base directory.
Have you tried just
<probing privatePath="SubPlugs" />
Alan.
|
|
|
|
|
Hello,
Thanks for the reply. I did just try SubPlugs, but it did not work.
So I have
PaintDNetWindow.dll which is found
and then there is
PaintDotNet.Base.dll
PaintDotNet.Core.dll
PaintDotNet.Data.dll
...
which are called from paintdnetwindow.dll
The config file does not seem to be even read.
Thanks
|
|
|
|
|
Hi,
When you say "the" config file does not seem to be read it made me wonder if you have edited the correct one. i.e. the ????.vshost.exe.config or the ????.exe.config. I assume that the first is read during hosted debugging sessions and the second in any other situation.
Alan.
[EDITED: Sorry daft response. If you are editing the app.config file in the VS project then both config files would be updated.]
modified on Wednesday, May 20, 2009 1:16 PM
|
|
|
|
|
I'm creating a DataGridView at runtime.
Looking for the AutoSizeColumnMode setting which is usually available on the properties pane, but it does not show up as an option.
How can I resolve that?
Thanks
|
|
|
|
|
Hi.
Try this myDataGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
The FoZ
|
|
|
|
|
Thanks but "System.Windows.forms.DataGrid does not contain a definition for 'AutoResizeColumns'"...
|
|
|
|
|
m12 wrote: Thanks but "System.Windows.forms.DataGrid does not contain a definition for 'AutoResizeColumns'"...
You originally said that you had a DataGridView. The error message suggests that you have created a DataGrid.
Alan.
|
|
|
|
|
That's strange... I have just done it and it works...
DataGridView dgv = new DataGridView();
dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
You haven't used 'DataGrid' by mistake have you?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Actually I did, thanks a lot!!
|
|
|
|
|
Make sure you're using the DataGridView control, not the DataGrid control. The DataGrid control was used in .NET 1.x and replaced in .NET 2.0 with the DataGridView control. The old DataGrid control is still in the ToolBox for backward compatibilty with the older control.
|
|
|
|
|
I need to change the default location that my application uses to reference files relatively. I use the syntax as follows: "..\\DBconnection.sec". This returns: C:\Projects\dotnet\RMS_IMCS\RMS_IMCS_WIN\bin\DBconnection.sec. I need the "bin" folder to be changed to RMS_IMCS.
my relative reference needs to look like this: "..\\RMS_IMCS\\RMS_IMCS_WIN\bin\DBconnection.sec".
This would allow me to chnage files located in folders outside my project without having to use absolute referencing. Any help?
|
|
|
|
|
Jacobus01 wrote: my relative reference needs to look like this: "..\\RMS_IMCS\\RMS_IMCS_WIN\bin\DBconnection.sec"
I would highly recommend building a fully qualified path to the file. Using relative paths is problematic because the CurrentDirectory for you app can change without you knowing it. So, get the fully qualified path to your executable, then use the methods in the Path class to manipulate that path to give you the one you want.
|
|
|
|
|
This is a hard thing to do. I have a solution in visual studio 2008 that contains multiple projects. Some are class libraries, some are web apps and some are win apps. Upon deployment I have no idea where all the apps will be located. They will however contain all their needed dlls in the bin folder. Not exactly sure where the web app will keep its dlls. This DBconnection.sec file contains an encrypted DB connection string. I decided to do this to avoid having to recompile the program if the connection string changes and it needs to be encrypted. Somehow my web application and win application needs to know where this file is located. I have a sub system that allows you to create this file but I'm unsure where to store it. How can I solve this issue and make this file available to both the win apps and web apps?
|
|
|
|
|
Each app is going to have it's own app.config for web.config. Class libraries don't get to use their own app.config. They use the config of the application that loads the .DLL.
Since the web app is going to be the most restricted in navigating the file system, the connection string should go in it's web.config file. The other apps can have their own app.config file that has the file path to the web app and can retrieve the connection string from that. I don't know your situation entirely, but I would consider putting the connection string in each config file. I'm just thinking about production and test environments when you might want one or more app(s) might have a different connection string from the others for testing.
|
|
|
|
|
What about encryption? I dont want my client to see the connection string (or any other party for that matter).
|
|
|
|
|
Your encrypting it now, right? It doesn't change.
If your not, then Google for "encrypt connection string" for a ton of examples.
|
|
|
|
|
Hi.
I've been trying to convert a function from an olf VBA project into C#. It uses the Quick Address API to check if a postcode as been recoded. I have managed to delcare the references to the API and managed to perform a search but when I try an retrieve the information it gives me an AccessViolationException. My class is.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace PostCodeRecodetest
{
class QAProClass
{
[DllImport("qapuiek.dll")]
public static extern int QAInitialise(long vi1);
[DllImport("qapuiek.dll")]
public static extern int QAPro_Open(string vs1, string vs2);
[DllImport("qapuiek.dll")]
public static extern void QAPro_Close();
[DllImport("qapuiek.dll")]
public static extern int QAPro_Search(string vs1);
[DllImport("qapuiek.dll")]
public static extern int QAPro_AddrLine(int vl1, int vi2, string vs3, ref string rs4, int vi5);
public string PostCodeRecoded(string postcodeIn)
{
string rsBuffer = "";
int lOpenReturn = 0;
int lSearchReturn = 0;
string sSearchString = "";
string returnedPostcode = postcodeIn;
string iniPath = "C:\\a_DEV\\Qapro.ini";
QAPro_Close();
QAInitialise(1);
lOpenReturn = QAPro_Open(iniPath, "");
if (lOpenReturn != 0) return "QAPro Failed";
sSearchString = postcodeIn;
lSearchReturn = QAPro_Search(sSearchString);
if (lSearchReturn == -9811)
{
lSearchReturn = QAPro_AddrLine(0, 11, "0",ref rsBuffer, 9);
returnedPostcode = rsBuffer;
}
return returnedPostcode;
}
}
}
I have left the old VBA declaration in. I already had some trouble as the DLL is 32 bit and a long was too big for the return values. The QAPro_AddrLine function basically returns a part of the address into rsBuffer from what I can gather. I can't find any documentation on the DLL. What can cause this type of exception?
Any help will be appreciated.
The FoZ
|
|
|
|