|
Greetings all,
Being as this is my first posting, please be forgiving on any breaches of etiquet.
I am using FitNesse to test some C# code and am having so problems with it.
My C# fixture has a method to initialise my tests that takes a CSV file and using LINQtoSQL, inserts a bunch of rows into a SQL database so I have a database in a known state.
When I run this method using a console application it works fine and my database is populated.
when I run this using FitNesse, the method fails. It gets as far as creating a LINQ context object for the database but when I check to see that the database exists (which it does. I do not create it on the fly.), the check comes back a false!
Does anyone know why this would be different? Can anyone offer any solutions/ideas?
Any help would be gratefully appreciated.
Thanks in advance,
Nick.
|
|
|
|
|
I have an application using cryptography, mostly in streams (file and memory) which I decrypt as needed into a new MemoryStream. All this works well.
Only thing is, I would like to trash the content of the MemoryStream when I am done with it (as well as strings etc I copy portions into) to prevent it ever getting paged to disk in decrypted form via the swap file.
In "good old fashioned" C++ I would just blitz the data with random rubbish before I deleted it - is there any way with managed objects?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
Thanks! I didn't think of looking for alternatives to string.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Interesting. Not heard of that before, but I'm curious as to how you'd actually use it. For instance, say I wanted to store a password someone had entered into a textbox - that's already available in unencrypted form in the Text property.
Even copying the password character by character which seems to be the norm with this thing would mean presumably interning the Text property of the Textbox - we've already lost the battle.
I think I'm missing something here - although its good that we can store things in memory in encrypted form how do we populate it, access it, compare it etc?
Regards,
Rob Philpott.
|
|
|
|
|
That does seem to be a problem on close inspection - to use it, it seems you have to get a pointer to unmanaged memory and then copy it out. Not sure this is going to quite do what I want - I'll keep looking tho.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Rob Philpott wrote: I think I'm missing something here
Yes, it's a tool. We are supposed to build are own solutions using it like Paul Glavs did[^]
|
|
|
|
|
I'm not that paranoid, but you could probably use unsafe code to wipe the string.
|
|
|
|
|
Let's assume this held your bank account number, login id and password, and your paypal details.
Feeling paranoid enough yet?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
Hi friends,
I wanted to add string resource to all exe and dll used in my project.
All exe and dll used in my project is not .net assembly, few of them are c++ and 3rd party dll.
At runtime I want to add/edit few string to all dll’s and exe’s used in my project, like myVersionInof, myImpectType etc, Which I can use in my project at runtime.
Can you guide me what should I have to use? Resource manager to add string resource.
Or add custom attribute to all my exe’s and dll’s .
Thanks
hiren shah
hirenkshah@gmail.com
|
|
|
|
|
This sounds a bit dodgy to be honest.
What do you actually need to do?
What is the reason for adding an attribute?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I agree with Nagy - it sounds dogdy, and will be difficult to do as that is exactly what antivirus software is there to prevent...
BTW Remove your email from your signature, unless you really like spam. Never post your email - give it to those who need it via private message instead.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
hey there,
I have another question about playing with windows accounts through C#..
is it possible to check weather the local administrator password is blank or not in C# code..?
Regards,
Priyanka
|
|
|
|
|
|
Hi,
Now, I have the c# code to execute a vbscript on a remote machine which then returns success or failure.
Now I just can not figure out how to return into c# the result of the script that gets executed.
I am using WMI at present.
Any thought please?
|
|
|
|
|
Hi,,
You can something like this
ManagementClass processClass = null;
processClass = new ManagementClass(manScope, managementPath, objectGetOptions);
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
string returnValue = outParams["returnValue"] == null ? string.Empty : outParams["returnValue"].ToString();
Hope it helps..
-Priyanka
|
|
|
|
|
Hi,
This is what I have now but I am not sure how to tell the code to use the vbscript i.e. Wscript.echo "hello"
Any thoughts please?
Thanks
System.Management.ManagementOperationObserver observer = new System.Management.ManagementOperationObserver();
System.Management.ConnectionOptions conn = new System.Management.ConnectionOptions();
conn.Impersonation = ImpersonationLevel.Impersonate;
conn.EnablePrivileges = true;
conn.Authentication = AuthenticationLevel.Default;
System.Management.ManagementScope ms = new System.Management.ManagementScope(@"\\" + txtTargetMachine.Text + @"\root\cimv2", conn);
ms.Connect();
System.Management.ManagementPath path = new System.Management.ManagementPath("Win32_Process");
ObjectGetOptions objectGetOptions = new ObjectGetOptions();
ManagementClass processClass = null;
processClass = new ManagementClass(ms, path, objectGetOptions);
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
string returnValue = outParams["returnValue"] == null ? string.Empty : outParams["returnValue"].ToString();
|
|
|
|
|
0. Try encoding your code in PRE tags to make it more readable; use the code block button at the bottom of this page.
System.Management.ManagementOperationObserver observer = new System.Management.ManagementOperationObserver();
System.Management.ConnectionOptions conn = new System.Management.ConnectionOptions();
1. Redirect the stdout stream - StandardOutput method of the Process class - and read that.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I am not sure what you mean.
Please give an example.
Thank you
|
|
|
|
|
For two days, it has been suggested you look at using the Process class.
If you run your script from within a process, you can redirect the stdout and read it within your program.
The other wapproach is in when you launch your process to redirect standard output to a file. Once your script has completed then read in the content of the file.
I will not google this for you, but there is a lot of information about redirecting output and launching processes from C#. Go read up on it, have a try and come back when you hit a wall. NB - that means yoiu have tried for more than five minutes.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hello,
I created a sample.vbs script which has this in it. i.e. Wscript.echo "Hello"
The strOutPut = "Microsoft (R) Windows Script Host Version 5.6\r\nCopyright (C) Microsoft Corporation 1996-2001. All rights reserved.\r\n\r\nHello\r\n"
After reading I have now tried to do the following:
string scriptPath = @"\\" + txtTargetMachine.Text + @"\c$\sample.vbs";
//string scriptPath = @"c:\sample2.vbs";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "cscript.exe";
//proc.StartInfo.FileName = "Wscript.exe";
proc.StartInfo.Arguments = scriptPath;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
try
{
proc.Start();
}
catch (Exception scriptError)
{
}
proc.WaitForExit();
int exitCode = proc.ExitCode;
string strOutPut = proc.StandardOutput.ReadToEnd();
string strErr = proc.StandardError.ReadToEnd();
proc.Close();
|
|
|
|
|
hi,
i am using for loop and assigning value to a string.the reference of the memory get cleared after exiting the loop but the memory exits ,so I wanna clear heap memory without using Garbage collection within the loop.
Reply soon.
Thanks in advance.
|
|
|
|
|
rajeshsha18 wrote: so I wanna clear heap memory without using Garbage collection within the loop
And how would you expect this to work? Strings are managed resources, so are subject to being tidied up by the Garbage Collector. Without using an unmanaged string, I couldn't see an easy way to satisfy this requirement. What could you possibly be doing that you wouldn't want to rely on the GC here?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Why do you want to do this? Garbage collection takes care of itself, so its something you rarely want to get involved with.
Regards,
Rob Philpott.
|
|
|
|