How to restore working solution? - visual-studio-2010

I was working on a C# project and everything works perfectly fine. But after I messed up with a code a little now its getting a wired error. But I can run the last working solution fine. Can I reset the code again to last working solution? If I can, what is the method to do that?
Here is the error message:
"Error 1 'Static_calc.Form2' does not contain a definition for
'Form2_Load' and no extension method 'Form2_Load' accepting a first
argument of type 'Static_calc.Form2' could be found (are you missing a
using directive or an assembly reference?)"

That sounds like you have deleted a method that your form is rely on in its designer code behind. Take a look in the designer file for Form2 for any event bindings that relate to Form2_Load and delete the line that mentions it.
You should then be able to view the form correctly in the gui and use it as before.

Related

Adding image to Xaml button breaks Xamarin app, but Visual Studio gives no error message

In Xaml, I'm trying to make an image do something when tapped (I'm testing it on Android). The Image tag of the Button class seems to be exactly what I need, but the following code breaks my application:
<Button Clicked="OnListClicked" Image="chimp.jpg"/>
Even though it works fine when I remove the Image tag. I could probably figure out what's wrong if I had an error message, but all that is shown is:
Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).
I've had issues with my Xaml code before, and I would get the same message. I'm confused though...my Xaml isn't external, is it? It's just a Xaml file inside my shared project, like any other file.
Under Exception Settings, I have every single box checked, and I also added XamlCompilation:
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace MyApp
{...
so I'm not sure what else I can do to start getting error messages. And I'm using Image in exactly the syntax described in the documentation, so I'm not sure what could be the issue with my Xaml. Anyone have any thoughts about any of this?
The reason I wasn't getting a specific error message was that I was actually navigating to the page with the errors from another page. When I set the page with errors to my root page, I started getting error messages again.
Apparently, my runtime's memory was running out before it could render the image. I had noticed before that my app was limited to five images: any images after the fifth one simply didn't show up. I've never gotten an error for it, though. Perhaps since this time it was a button, it "needs" to be displayed for normal functioning, and that's why it's throwing an error this time?
Either way, I just removed images until there were only 5, including the button image, and now it displays without issue. I'm not sure if this is expected behavior, though. I don't see why my runtime wouldn't be able to handle more than 5 images.

Fail to load assembly on a MVC View

Some Context
I have one closed source asp.net MVC application distributed for several customers. I'm trying to develop a extension to include some very specific functionalities that will be used by a single customer (he will also have the extension source code).
I'm developing the extension as another mvc project, loaded as an area. I'm trying to avoid having to deploy the extension binaries in the main application '/bin' folder.
I'm loading the extension assembly and it's dependencies manually in the PreApplicationStartMethod of the main application assembly. The area registration process went fine and the area routes are registered as intended.
The Problem
When I try to load some extension pages, I got a "The view 'xx' or its master was not found or no view engine supports the searched locations." message. I investigated I little and replaced the view contents with a 'Hello' string. The view was rendered correctly.
I tried to produce a minimal that triggers the error and turns out it's the '#model'directive. I tried to figure out what's happening and It's an assembly loading error. I created a minimal view with '#model object' and tried to cast the Model to original type and got the following error message: "Could not load file or assembly 'xxx' or one of its dependencies. The system cannot find the file specified." (this assembly contains the class type used by the view)
Just to confirm the issue, I moved the mentioned assembly to the main application '/bin' folder and everything worked.
I also inserted some model manipulation instructions on the controller, just to investigate if an exception will appear but everything went fine, I could even render a grid using json.
I'm loading every assemly with:
var assembly = Assembly.LoadFrom(file)
BuildManager.AddReferencedAssembly(assembly)
There's something extra I need to do ?
Needed to add the assembly private path
AppDomain.CurrentDomain.AppendPrivatePath(pluginFolder);
Don't know the real explanation for it but I guess it's relates to the use of Assembly.LoadFrom(file) instead of Assembly.Load() and the fact that views are compiled later.

References for MVC extension methods differ between vbhtml and cshtml files?

I am converting the login views of an application from vbhtml to cshtml. In the vbhtml files the original developer calls an Html.LabelWithAttributesFor extension method. When I write the same line of code in the new cshtml file the extension method isn't available via Intellisense and fails to compile. Are references not shared between vbhtml and cshtml files in a project?
Wanted to circle back and close this question with the "answer". In the end, what seems to have knocked something loose was when we removed the vbhtml pages from the solution. All use of the Extensions had been removed prior to our removing the vbhtml pages and other developers had worked on the solution in the interim making other changes. Fast forward a few months to another developer needing the extensions. He added a reference to the project with the extension methods and used them on a new cshtml page, which worked fine. So, the problem is solved but I still have no idea what caused the problem in the first place and I have been unable to reproduce it.

New to Ajax programming and need some help

I was told that AJAX would be the best toolbox to use for building the type of application I am interested in creating.
That being the case, I fired up an old copy of Dreamweaver MX2004 I have and started creating the *.htm, *.js and *.php files. However, when I loaded these files onto my server, I was unable to get the program to do anything. I tried to view the program in IE8, if this explains anything.
Where am I screwing up? Do I need to set a certain flag on my bowser?
I look forward to you response.
Does your server have PHP support? What does "unable to get the program to do anything" actually mean? Are you getting error messages? Unexpected results?

netbeans form loading issues

Error in loading component: [jDialog]->mainPanel->titleBar
cannot create instance of <qualified classname>
The component cannot be loaded.
Error in loading layout: [JDialog]->mainPanel->[layout]
Failed to initialize layout of this container
Errors occured in loading the form data. It is not recommended to use this form now in editable mode - data that could not be loaded would be lost after saving the form. Please go through the reported errors, try to fix them if possible, and open the form again. If you choose to open the form as View Only you may see which beans are missing.
recently moved a class that was being used in several forms but all the paths in both form and java files were updated to point to the new location. Anyone know what could cause an error like this?
Things I have tried: clean + build, removeing and re-adding all library jar files, making sure the title bar and the old version in SVN were identical except for the package changes. Doing the same comparison with their respective form files.
In the View menu there is an IDE log option that allowed me to see what was happening behind the scenes to cause this error.
custom code for the text of one of the labels was throwing an exception.

Resources