VS2015 New web form pages created empty - c#

Ive been away from .Net web dev for a few years and am now coming back to it inorder to update a client project. I've installed VS Pro 2015(legit no cracks) and am now experiencings some odd behaviours both with the project/website files and VS.
The first 'issue' I need to tackle is that when adding a new master page or webform to the project, these new documents appear completely empty. There is no code or markup generated in the documents eg: 'docname.master', 'docname.master.cs', 'pagename.aspx', 'pagename.aspx.cs'.
I doubt this is the correct, behaviour since it wasn't in the past. So have things changed, and this is expected, and I need to get up to speed. Or, is there something wrong with my set-up -which I expect- ? If so, do you have any ideas what I'm doing wrong? What can I do to rectify this?
UPDATE
I've just done some testing on a different machine and it appears that this seems to be connected to the fact that the files I've been working with are located on a network file server. Is this a known issue, and are there any fixes/workarounds?

In my case it turns out that the cause of this and several other issues was purely down to the fact that the project files I was working with were located on a network drive.
It appears that this is a fairly common problem, especially when access to the network / remote drive is quite slow.
Simply switching the project files to a local drive fixed all the problem I was experiencing.

Related

New C# project cannot open ACCDB microsoft database file

I recently had a new project assigned to me (I'm new to C# and I'm a junior). It makes use of a Microsoft access database file (.accdb file)
I've imported the project into Visual Studio but I can't for the life of me run the code. Initially I had file register issues, and I think I managed to resolve that by getting the IT teams to install a "2007 Office System Driver: Data Connectivity Components" driver from the Microsoft website.
Bow the error says:
System.Data.OleDb.OleDbExceptions: 'Cannot open database''. It may not be a database that your application recognizes, or the file may be corrupt.'
The team I'm trying to help only has one dev (working from a different country) who is the main person to handle the code. It works on her side, but she doesn't really have the experience to help me troubleshoot this.
I tried sending her my database file, for her to swap her file for mine, and she said it was still working, so it sounds like the issue might not be to do with the file?
Could I get any help if possible? So far my only approach is to keep googling the error.
But the only resolutions I see are from people who have database files nearing their file size limit (2GB). My database file is just 1MB.
The database file is password protected (the password happens to be in the code). I opened the database file (Microsoft access opens) and entered the password and I had no issue accessing the data)
Out of luck, I managed to find the right article to help me!
The issue with Microsoft access database files is only one user can really use then at a time I believe.
I saw a forum about potential locks made by other users. I googled how to remove locks but it seems that it might not be a lock issue (Microsoft creates a lock file which I dont have).
Regardless, I assumed that the issue is still somewhat similar. Since I had access to the database in Microsoft Access, I decided to open a new database, then go to external data tab and click on access to import EVERYTHING from the other file. Then I just renamed to old file and give my new file the original name.
I reran the code and it worked!
I dont know why the other dev had no issue opening the file. My assumption is that because she is the only developer her laptop is already 'set up' in some way to run everything as normal, whereas if someone new tried (or if something happens and she has to re-open the code on a new laptop) they would have to try and replicate the 'set up' or try and work from scratch
Hope this helps

Xamarin Forms PCLStorage files are lost after app stops debugging

Using PCLStorage in Xamarin Forms I can create a local folder and store images downloaded from Azure.
I can then successfully test to see of the images exists using
ExistenceCheckResult fileExist = await MyFolder.CheckExistsAsync(fileName);
However, once the app has been stopped (by stopping debugging in Visual Studio) and restarted, if I run the test code above, it fails and tells me the images do not exist.
Do files then only exist for the time the app is running?
This thread looks like it could possibly cover what you are experiencing:
https://forums.xamarin.com/discussion/87498/i-am-using-pclstorage-where-are-the-files-going-to
Reading up on this, the file persistence side of things looks like debugging should not affect it, as once it writes the file - then it's in the specified location.
Also - looking at PCLStorage and the last time it was modified, if this is a new addition to your project, I can't say I would recommend it, as it looks like it is no longer being worked on, and hasn't been for some time.
I would go with an implementation from System.IO as it is now supported within .net standard 2.0 - and there appear to be lots of great examples for you to follow.
If this doesn't help, then post some more of your source code so that it can be looked into in further detail.

Database solution based on MS Access

I have a pretty strange question for you:
At my office, my colleagues save data in a shared Excel document, which crashes very often due to the shared file format, and the many users who use it at the same time.
I tried to create an Access based solution with forms, and it worked pretty well, until it turned out - in the middle of "development", half of my colleagues have x64 OS and the other half have x86 architecture, so most of the VBA code cannot be used - smaller problem - , and the published code is not executable on x64...
My question is: If I build a Windows form that connects to a backend Access database, can I get rid of the x64-x86 problem? Saving to database file will be faster/safer than using the Excel format or I can start everything from scratch after 4 weeks of usage of the access solution? (Probably 20 users max)
And here comes the fun part...I have to cook from what I have :D I have no available SQL server, no Visual Studio at the office... so I have to build a portable WinForm with app configs at home to connect to the access database, saved at our shared network.
What do you think is this possible solution? Or should I try to find a different one?
Many thanks in advance:
Matt

Debug ASP.NET CMS

We're developing a custom Content Management System in ASP.NET 4.0, using Team Foundation Server for source control. The database is hosted in a remote server, whereas the debug is done locally, thus new content (aspx pages) created by each member of the team is stored in our local computers and unavailable for other team members. I don't think adding those files to source control is the best approach, but the only other way I see is deploying to an external IIS for debugging.
Have you already worked with this scenario? Wwhat do you think is the best option? Thanks in advance
thus new content (aspx pages) created by each member of the team is stored in our local computers and unavailable for other team members ... I don't think adding those files to source control is the best approach
I really wonder why you think that is a bad idea... I think adding created code in your source control system is the very best thing to do.
What do you think happens if a computer stops working, gets stolen, etc? How do you obtain the file again? Store every file that is crucial to your system in a source control system.
I guess you can have a "tools" folder in project structure where you keep all of your test pages. Then when project is built that folder can be excluded from copying.
For example when Release build is executed "tools" folder is excluded, while Debug builds leave it in the project.
It really depends how do you guys work, how many of you there are, how often do you do delivery cycle - but generally garbage of test pages tends to grow all over the place (same as commented out code) if there is no systematic approach and whole project team chips in.

C#/IIS/MVC: Static Conetent not loading on different environments

I have a C# MVC 4.5 Website where everything works as expected, until recently, when I added a new folder.
It was meant to house CMS-type applications and keep them separate from the main site. As I built these apps I checked everything on my local instance of the site, and it all looked fine.
However, since I pushed the updates to DEV, I'm getting some odd and unexpected results - displayed below.
Here's a pseudo-file structure:
Solution 'MySite'
MySite
Controllers
Images // Images from this folder appear normally
Models
Scripts // Scripts from this folder load normally
Views
Admin
AdminApplication
Index.cshtml
Shared
admin_common.css // 500 error
admin_common.js // 500 error
Images
banner.jpg // will not load
Keep in mind all these issue are only on Dev, everything on local is fine. It seems very weird that a css file would load, but not have any content.
This is how the styles and scripts load in the layout:
#Scripts.Render("~/Shared/jquery.js") // loads fine
#Scripts.Render("~/Admin/Shared/admin_common.js") // 500
#Syle.Render("~/Admin/Shared/admin_common.css") // 500
Here's what I've tried:
I looked at log files, but they all say the files loaded fine. I only see 200's, no 500's.
I looked at the static content option in IIS, as seen here: http://adilmughal.com/blog/2011/11/iis-7-not-loading-css-and-image/ but it's an IIS-wide option rather than folder-specific.
When I visit the URL of the css, I get 500: Server Error [10-0002] so I looked for that, but the only thing that seemed useful was this, https://communities.ca.com/thread/110605407, a deep comment said their isapi file was missing. I checked my web.config file, and tracked down the isapi files, and they looked fine.
I tried the Failed Request Tracing, as specified here: IIS 7 gives me error 500 internal server error when trying to display my XML document, but there were no logs there, even though it was on.... which is weird, but not what this question concerns.
I also tried adding an httperror line to web.config like this says: https://serverfault.com/questions/407954/how-to-diagnose-a-500-internal-server-error-on-iis-7-5-when-nothing-is-written-t. It should give better errors, but it doesn't.
What is causing my development machine to not display this necessary content?
TL;DR: an unnecessary web.config file with missing isapi handlers.
When I first started the new folder, Admin, I wasn't sure how it would work. I read somewhere that it would need it's own web.config file. So I copied a bare-bones web.config file from somewhere into the new folder.
Later on, I changed the name of it to web.bonfig, to make it inactive (b for backup).
My current theory is perhaps there is a different precedence of conflicting config files on the servers (but where would something like that even be defined?). This morning I changed the file name to web.bonfig.backup-ignore from a Windows Explorer window and that seemed to have fixed my issue.
BTW web.bonfig only had one handler defined in system.webServer. This would suggest that solution 3 in my question was the correct solution, but I was looking in the wrong config file.

Categories