|
We can't tell either: you need to read the error message carefully and do what it says.
It tells you exactly what you need to do to get the actual error report to be visible - message, stack, the whole enchilada. Do what it says, and it will tell you which file, which line is caising a problem, and what problem has been detected.
But until you have that, nobody can fix anything.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
If "your" code crashed the "server", who is at fault then?
You? Or the server for not anticipating your code? Both?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
i am looking for guidance or best practice to review my code or review my colleague code working in same company.
two way i guess exist to review code. one is manual process and one should be automated process where people may use various tools to review code.
so please discuss two different process called manually review code and automated way review code using tools.
please guide me in details. thanks
tbhattacharjee
|
|
|
|
|
For automatic reviews, you can use FxCop and StyleCop. For manual reviews, you really should search the web for manual review processes, read them and agree with your colleagues on the best approach to conduct reviews; that's partly going to depend on your code cycle workflow (do you review pre commit to Source Control, or do you do it post commit and in a separate review stage for instance). We can't really help you that much on that side.
This space for rent
|
|
|
|
|
"Review" for what?
How do you measure "success"?
Machine learning involves calculating "distances" from some "ideal".
You need to "classify" your problem (i.e. what are the "measures") before you can achieve anything meaningful.
Unless you actually have some "good code" as a reference and for "training" purposes, you will get nowhere.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Do you know what control can add photos and text horizontally as an attached file, when clicking on add button will put the image into the box, if the cell does not have image, insert the image in the horizontal box, if any. Horizontal cell is inserted into the new cell line. You see the attached image file. [IMG]http://imagizer.imageshack.com/img922/2316/JSa9oK.jpg[/IMG]
|
|
|
|
|
There is no ready-made Control which does exactly what you want.
I suggest you create a UserControl which has for example a Button and a ListView (and perhaps something more) and you write the code needed for your requirement ...
|
|
|
|
|
If it is a website you are building, have a look at Metro UI as a framework. They have some very nice controls for doing what you describe.
|
|
|
|
|
A StackPanel with the Orientation set to Horizontal; or a WrapPanel.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Could you tell me I know StackPanel and WrapPanel it belongs to Visual Studio ? I did not find StackPanel and WrapPanel in Visual Studio.
|
|
|
|
|
They are used in XAML applications such as ones built by WPF.
This space for rent
|
|
|
|
|
In WinForms, use a normal panel. Drop some smaller panels in there with align=left, and it would fill from left to right.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Dear Experts
Following not a big Thing, I'm more asking where I'm missing the logic.
a.) Example which compiles
public void OutExample_03(out int outValue)
{
outValue = 0;
try
{
}
catch (Exception excpt)
{
Debug.WriteLine(excpt.Message);
}
}
b.) Example will not compile.
Message: The Out Parameter 'outValue' must be assigned before control leaves the current method.
public void OutExample_04(out int outValue)
{
try
{
outValue = 0;
}
catch (Exception excpt)
{
Debug.WriteLine(excpt.Message);
}
}
Does the Compiler assume for b.) that also enter the "try section" could not happen?
Thank you very much for your comments in advance.
[Edit]
VS 2013 Express.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
|
Thank you very much for this. I read that link already, but a confirmation from you helped a lot.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Again me
On the other hand
public void OutExample_03(out int outValue)
{
DoAnythingBefore();
outValue = 0;
}
does also compile, so I really don't see the logic why try catch will be handled Special.
It is like it is 
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Because at Compile-Time the Compiler doesn't know if the Try-Cath COULD be succesful or not. It only recognized that there is a possibility for not-assigning the variable ...
|
|
|
|
|
Because, as already explained, the try block can terminate before the variable has its value assigned. In this case the catch part will be called and the method returns, but the value of outValue is indeterminate.
In the case above it is assumed (by the compiler) that one of two things will happen:
1. The method completes successfully, in which case outValue will have been correctly assigned.
2. An exception occurs, in which case the method will not complete, so the value of outValue does not matter.
|
|
|
|
|
Let me give you an example that might clarify it for you.
public void ThisIsaReallyStupidThingToDo(string input, out int value)
{
try
{
if (string.IsNullOrWhiteSpace(input))
{
throw new ArgumentNullException($"The value of {nameof(input)} must be set");
}
int.TryParse(input, out value);
}
catch (Exception ex)
{
}
} So, if you pass in an empty string, value will never be set because you bypass it completely and hit the exception handler. That's why you have to handle value outside the try/catch.
This space for rent
|
|
|
|
|
Thank you for your Feedback.
Yes all of this I'm aware. But it is not a real Explanation why
{
outParam= ..
} vs.
try
{
outParam= ...
}
will be handled different. I don't see a chance that in the sequence "try{ outParam= ..." something strange can happen.
Anyway it is more a philosophical thing not a real Problem.
Thanks again for your Feedback.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
It is a real explanation. It's about consistent predictable behaviour. Because the code can cause inconsistent behaviour in the try block, all cases have to be handled consistently. Put it another way, what if the JITter was to reorganize the code inside the try block, you could end up with a situation where things blow up because you allowed an inconsistent behaviour.
This space for rent
|
|
|
|
|
I Need to think about it. Most probably I'm too much fixed to my thoughts at the Moment.
Thanks
Bruno
modified 19-Jan-21 21:04pm.
|
|
|
|
|
It is not treated different. The compiler does not check if the code-block is doing something usefull. You introduced it, so it probably has a use (take not of post-processing like some code-injecting frameworks).
It merely checks whether each block has a correct flow. What use would it serve to also see if your code-block does throw exceptions, simply to check whether the exception handler "might" fire? Would make compiling a lot slower, since it would be checking a lot.
Now what is the upside of this check? To not run into the warning?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have created the following code
var filename = "wwwroot/Counter/Counter.txt";
var counterStream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
var reader = new StreamReader(counterStream);
var visits = Convert.ToInt32(reader.ReadLine());
visits = visits + 1;
var writer = new StreamWriter(counterStream);
writer.Write(visits);
counterStream.Dispose(); As you will realise, it is a counter for a website I am building. I am OK down to the line.
visits = visits + 1 Visits does contain one more than is originally stored in Counter.txt. However, the last three lines are not writing anything back to the file. I was expecting it to write a new line in the file, although obviously I want it to replace the original finally. I am at a loss as to why it hasn't. Could someone point me in the right direction, please.
|
|
|
|
|
You need to position the file pointer to the appropriate place, either by reading all of the existing lines (and keeping only the last one), or by using Stream.Seek to reposition the file pointer back to the beginning before the Write.
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|