.resx File Size Issue - c#

I am working in Visual Studio 2010, on a fairly beefy machine. I have a solution with a few different projects under it like so
Solution
Activations
DatabaseManager
Library
VideoResources
WindowsNewUI <--- start up project
In video Resources I have one .resx file in which I have placed about 700mb of compressed videos. When I build this project by itself, the build succeeds. Then I hit f5 to run my new UI and I am given this error.
Error 1 Unexpected error writing metadata to file VideoResources.dll -- 'Not enough storage is available to complete this operation.
I have done some digging and it seems to be a ram issue. I have tried the /3gb fix by editing the .ini file, but this does not solve the problem.
My question is what the heck am I doing wrong here, I know that 700mb is a lot of video, but there is no reason that that specif project should build, but then fail the rest of my project, is something else going on here? Does the access modifier of that projects resource file mater? How can I resolve this issue?
Also if I place about half of my video files in the .resx then everything works just fine.

My suggestion would be to not store the video in any type of embedded resource. Thats going to cause your app to us a ton of memory while it is running. I would suggest that you instead just leave the files on disk and load them from there. This would also fix your problem.

The resource file infrastructure is probably not designed to scale to these file sizes. Remember that every operation in a resx file happens in memory, and you're using a garbage-collected language.
Why not just store the video(s) in the filesystem and read them as needed?

Related

C# how to compile programmatically while embedding .resx resource file

This question might seem dumb, but I cannot quite understand the concept of C# compilation
I'm working on a C# project that contains two merged solutions
The first solution saves settings in the form of .resx resources files and the second solution reads them in said resx file located in roaming directory using Resource Writer and resource reader.
Now my problem is that I want the first solution to be able to compile the second solution's exe file while merging or embedding the resx file that contains the saved settings.
I'm not sure what should I do or what should I use or how to do this, this is my first time working on something that manually compiles the solution, I would've searched it on the internet but there are not a lot of tutorials concerning this specific matter, I felt lost and thus I'm seeking help from this forum in the hopes of finding a fix for this frustrating matter.

C# dll I made sometimes gets "blocked" in the file properties when downloaded

I have a C# application that is available online for download. However, when customers download it, there is a one .dll that I created which SOMETIMES becomes "blocked" and needs to be "unblocked" by going to the file properties and clicking unblock. The.exe won't run because this. I cannot figure out why Windows decides to block it.
I know that I can programmatically unblock the file as well by using Unblock-File in PowerShell or Streams.exe. I also know that by editing the ZoneIdentifier of a file, I can MANUALLY block files in order to somewhat reproduce the issue. I cannot however reproduce the issue by download. I've tried downloading my program from the website in Win10 & Win7, and have even edited the "Do not preserve zone information in file attachments" in gpedit as well, all to no avail.
My question is, why is it that SOMETIMES my .dll gets blocked when downloaded from the internet? How can I prevent this block from happening, by digitally signing the dll?
Am I doing something wrong when I package my C# solution? Is there a way to reproduce a particular download from being blocked?
I don't know the reason. As far as I know, if you download any unknown dll or executable (specially in Chrome), it will be blocked and you can't use that binary file in your project until you unblock it.
Solution: Take dll and whatever you have in a zip or rar file. Then download and extract the zip file in the customer system.
Even some Microsoft binaries are delivered in zip format. Consider looking at Process Explorer.

Is it possible to have a Resource folder in a published C# project?

I have a question which will probably be quite vague.
I'm developing a Windows Forms application in C# that can read and write games to an Access database. Every game has an attribute that links to an Image in the resource folder.
While debugging I was able to just read and write my screenshots to the following path:
"..\\..\\Resources\\Screenshots\\";
I tried publishing my application earlier today to test if it would still work and if not, to locate the path where the Resource folder would be when published.
So far I have the feeling that the resources just get burned into the exe file or one of the other files it generates.
Is it in any way possible to have a real folder in the published version of an application from which I can keep reading and writing my images like I did while debugging?
Thanks in advance.
Yes your screenshots will be compiled into the assembly as resources when publising.
As for the real folder, you can absolutely do that. Make sure you give your app the right path to that folder.

.NET random assembly is modified on disk

One of our applications is started suddenly terminate with error "Can't load file or assembly" . After some research I found that one of DLL files used by app is changed it's size by 1-2 bytes.
After playing more with it I realized that it's related to all dll files used by application and any of them can be corrupted. We have same copy of application on another box and it runs without issues. That makes me think it's related to environment.
How can I find what process and when modifies the file? What can be reason? Does this happened to any1?
If you have access to the computer where this is happening you can use FileMon to monitor the assembly files and find out which process is changing them.
This sounds suspiciously like some sort of virus or antivirus gone wild situation.

File.Copy fails when copying a DLL that is not in use

I've built a winforms app (C#) that will take a list of file paths, and copy those files (from a different VS solution) to a new location (In a folder the user specifies) in the same directory structure they currently exist on local file system.
I use the Path class, Directory class etc and everything works wonderfully...except when it reaches a file path that points to a DLL.
The DLLs I am trying to copy are a part of the other solution, and that solution is not currently open.
I have tried restarting computer to make sure visual studio isn't somehow hooking into that DLL even after the solution is closed.
The DLL in question can be copied by regular manual means (i.e. copy and paste shortcut).
So short of creating a batch file in the program, and running xcopy on that DLL path, I don't know of a way to get this to work.
From what I have found from google searches (which isn't much on this particular situation), File.Copy() should work..
Any help would be wonderful, even if it is a link to a duplicate question I may have over looked.
Thanks!
-The error message is: The process cannot access the file [insert file path] because it is being used by another process (The path is definitely correct also)
-Just downloaded and tried to search for the DLL name with Process Explorer.. I also ran a similar exe from command prompt to no avail. It claims nothing is using it. That's why I am utterly baffled by this. Also, I just checked the permissions and everything looks great (i.e. Full Control, owner effective permissions)
-It does not handle open files. It basically build the correct src and dest paths and does a File.Copy() on those. How would I go about handling open files? I'm sure I could figure out if it was open, but what would I do it it were open?
It is not complaining about the file you're trying to copy, it is complaining about the file that you're trying to overwrite with the copy. Lots of candidates for that, virus scanners always get very excited about new DLLs, for example. Or it is loaded into a process, the typical failure mode for trying to implement your own auto-updater.
You can rename the target file to make your copy succeed.
Are you in vista or win7? If so, Check your 'User Account Control Settings'. Sometimes this can interfere with .NET security options and prevent file operations that would otherwise work.
As well as Process Explorer, I would use Process Monitor also from Microsoft so you can see what is happening at the point of failure and allows you to see if anything else is accessing the dll.
Possible culprits are
the program you are running,
your antivirus package
a virus.
If the path it is complaining about is the destination path, then is is possible that the path is too long?
Also, when using Process Explorer, make sure you have enabled the option to show details for all processes and not just your own.
I just ran into this issue as well. I tried copying a .DLL from an FTP server to a local directory (replacing the existing one) and for the life of me I could not get it to work. Keeps giving me an 'Access Denied code: 5' Error.
I then realized that the .DLL on the FTP server was not marked as hidden while the .DLL I was trying to replace was marked as hidden.
Once I changed the local one to also be visible. I had no more issues.
So my solution is:
Make sure both files are visible.
Hope this helps someone

Categories

Resources