|
Have you tried the view details link on the exception dialog? That should give you more details, including a stack trace that help to narrow your problem.
only two letters away from being an asset
|
|
|
|
|
|
Can i use Lambda Expressions in C# 2.0?
|
|
|
|
|
No. C# 2 doesn't provide lambda expressions, C# 3 does however. You can use a more verbose form of a lambda, an anonymous method, in C# 2.
public void DoSomething()
{
int someLocal = 7;
MethodInvoker anonymousMethod = delegate
{
MessageBox.Show(someLocal.ToString());
};
}
|
|
|
|
|
Hi,
I have come across a big problem.I have developed my application in C# just a few days before and today when I when searching the internet I found some software like ".NET Decompiler" . I wondered that how is it possible ? Then when I downloaded it any opened my executable it it, With my wonder the whole exe was converted to a full formated source code !! I was just too much shocked seeing all this ! What's it ? Any problem in .NET Complier method or what ? How can an exe be converted to source code ? Anyone PLEASE HELP...
Thanks,
Dan.
|
|
|
|
|
|
That's how it is in the .Net world.
It gives advantages like the cool features available in reflection but unfortunately it exposes the inner workings of your code to the outside world. You could try using an obfuscater to make your source less readable.
Russ
|
|
|
|
|
Dan`M wrote: I have come across a big problem.I have developed my application in C# just a few days before and today when I when searching the internet I found some software like ".NET Decompiler" . I wondered that how is it possible ? Then when I downloaded it any opened my executable it it, With my wonder the whole exe was converted to a full formated source code !! I was just too much shocked seeing all this ! What's it ? Any problem in .NET Complier method or what ? How can an exe be converted to source code ? Anyone PLEASE HELP...
The .net compiler includes a lot of information in the executeables for debugging purposes. If you don't want your code to be easily read, you need a .net obfuscator. I think one is included with VS2005.
Nathan
|
|
|
|
|
|
Neither .NET or legacy VB are safe against decompiling - it's just more obvious in the case of .NET.
A compiler converts your program from human readable source code to something the computer can easily execute. This is done to help the computer execute your program more efficient - it is not something you do to hide your source code, so you should not be surprised the code is still accesible after compilation.
.NET (and Java for that matter) compiles to a "higher level" than the old VB and C++ compilers and it carries more metadata on the program (method names etc) that makes decompiling them easier than for example C++ and VB programs. Decompiling VB and C++ is still possible however (but obviously not with a program designed to decompile .NET code), so you should NEVER rely on your code not being decompiled as "security".
With regards to security in general, maybe you should for a split second consider that it's not all about the programmer. It's obviously more secure for the user to run a program that has proper metadata to allow the runtime to verify what is going on - Running a program that deliberately try to hide what it is doing can be called a lot of things, secure isn't one of them.
And experienced programmers know there is nothing exceptional clever in their code anyway, so why try to hide it?
|
|
|
|
|
lmoelleb wrote: And experienced programmers know there is nothing exceptional clever in their code anyway, so why try to hide it?
Ya.. that's true sprit of programming. No matter if the app has secure coding .
Anyway , best wishes for programming from me.
Thanks,
Dan
|
|
|
|
|
If you think secure coding has anything to do with people being able to see your code or not, then you known abselutely nothing about secure coding.
If you do not have basic knowledge on for example the functions of a compiler, you are still very far away from understanding the concepts of security. This is fair enough - we are all learning, but I recommed you try to avoid smart comments like this one until you optain some more knowledge.
|
|
|
|
|
Dan`M wrote: Nathan Holt at EMOM wrote:
I think one is included with VS2005.
I can't get it . Where is it ? Please give some more details ...
I looked in Visual Studio 2003 Profesional and found under the tools menu "Dotfuscator Community Edition" I believe that is the included obfuscator, and it will probably be in the same place in VS 2005
Nathan
|
|
|
|
|
|
I have a written a component that solves Word Up boards (a word game of sorts). This component is used via a Web Service interface by Websites for graphical display of these solutions. It was all working fine until I tried to refactor some of the code into a base assembly (another DLL). Now, even though both of these assemblies are referenced and deployed with the Web Service application, only the latter assembly appears to be picked up.
To summarise... Web Service deployed with Two DLLs (a hierarchy) only appears to load the second of the two and hence none of the base types are available at runtime (no errors, no exceptions, just a crash!). I dont really want to have to try and dynamically load the assembly via Assembly.Load as the solution works fine apart from when it is deployed behind a Web Service.
Any ideas guys?
Thanks,
Alex.
|
|
|
|
|
Hello,
I am trying to cobble together some C# code to make my powershell scripts launch from buttons on a menu. I seem to be running into about 6 or 8 syntax errors. I don't know C#
very well yet, so I have a hard time finding these kinds of issues. Here is my code, if someone would be so kind to look it over...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Management.Automation;
using System.Collections.ObjectModel;
using System.Management.Automation.Runspaces;
/// Class that assists in asynchronously executing and retrieving the results of a powershell script pipeline.
public class PipelineExecutor
{
/// Gets the powershell Pipeline associated with this PipelineExecutor
public Pipeline Pipeline
{
get;
}
public delegate void DataReadyDelegate(PipelineExecutor sender, ICollection data);
public delegate void DataEndDelegate(PipelineExecutor sender);
/// Occurs when there is new data available from the powershell script.
public event DataReadyDelegate OnDataReady;
/// Occurs when powershell script completed its execution.
public event DataEndDelegate OnDataEnd;
/// Constructor, creates a new PipelineExecutor for the given powershell script.
public PipelineExecutor(Runspace runSpace, ISynchronizeInvoke invoker, string command);
/// Start executing the script in the background.
public void Start();
/// Stop executing the script.
public void Stop();
}
namespace ScriptLauncher
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
private string RunScript(string scriptText)
{
// create Powershell runspace
Runspace runspace = RunspaceFactory.CreateRunspace();
// open it
runspace.Open();
// create a pipeline and feed it the script text
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(scriptText);
// add an extra command to transform the script output objects into nicely formatted strings
// remove this line to get the actual objects that the script returns. For example, the script
// "Get-Process" returns a collection of System.Diagnostics.Process instances.
pipeline.Commands.Add("Out-String");
// execute the script
Collection results = pipeline.Invoke();
// close the runspace
runspace.Close();
// convert the script result into a single string
StringBuilder stringBuilder = new StringBuilder();
foreach (PSObject obj in results)
{
stringBuilder.AppendLine(obj.ToString());
}
return stringBuilder.ToString();
}
MessageBox.Show(
private void button4_Click(object sender, EventArgs e)
{
"I'm so happy", "Whoopee!!!");
}
}
}
}
|
|
|
|
|
Im trying to access a certan column in a data bound DataGridView like this.
int index = (int)dataGridView1.Columns["SomeColumn"].DisplayIndex;
But some how i allways got the "dataGridView1.Columns["SomeColumn"]" to be null. That is it is not set to an object. But if i use the syntax
int index = (int)dataGridView1.Columns[0].DisplayIndex it works fine!
Any ideas? Ive got nothing
Thankz
|
|
|
|
|
dataGridView1.Columns[0].Name
|
|
|
|
|
Yes but isnt it possible to access both like Columns[integer] and Columns[String]?
Then i dont have to know the actual index for the column i seek. Thats the beauti
|
|
|
|
|
See, I know that Columns[string] works so without further evidence I am forced to assume that you are not using a valid string value. My post was suggesting that you look at the Name properties of all the columns to find your error. Apparently my short post was not enough to steer you in that direction.
|
|
|
|
|
Oh man! You where right, what a god damn rockie misstake
In the database the columns name i CustomerID so naturaly i tryed that. But the true name was customerIDDataGridViewTextBoxColumn
Thanks for the help!
|
|
|
|
|
hi,
I have a textbox. how can i avoid that a user types strings in it, bud only decimal values?
thanx
|
|
|
|
|
Djavid j wrote: I have a textbox. how can i avoid that a user types strings in it, bud only decimal values?
MaskedTextBox could be used, or you could handle the Key events (KeyDown, KeyPress, KeyUp) and look at what was typed there, only allowing characters that pass your criteria through.
There may be other ways.
Good Luck!
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
Or use a NumericUpDown instead.
|
|
|
|
|