Error Extracting Public Key from .snk - vb.net

My project has started regularly exhibiting this error;
Error Error extracting public key from file 'FishTracker.snk': The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020) FishTracker C:\Users\dom\Documents\Visual Studio 2015\Projects\FishTracker\FishTracker\vbc
Has anyone else experienced a similar error and can shed some light on what other process might be using the file? I've looked closely at task manager and can see no indication of anther process that might be using this. Restarting the machine does cure the issue.
If it's possible that the .snk file has become corrupted is there intrinsically anything wrong with deleting it and creating a new one?

Related

Microsoft Visual Studio VB.NET , could not find file error

I have encountered an error of ' Could not find file [file path] ' and is making my build fail.
I have tried to troubleshoot myself and find solutions but to no avail hoping that I can find a resolution here.
I apologize if my posting format is wrong again, I am a student and not a full time programmer.
I deleted a file in the resource folder before deleting the picturebox in the design and it caused this error making me unable to view the design or run the program at all.
I have tried restoring the file but it doesn't work.

The specified procedure could not be found - how to identify?

I'm developing plugins for a program. Whenever I try to load my plugin in that program it crashes with an the specified procedure could not be foundbut nothing more.
Well to have an insight I tracked with Process Monitor (or ProcMon). I set the filter to just print messages for the process of my main program. However that application shows me including the libraries ends (after wandering through PATH) at the right file - i.e. Result: SUCCESS.
So my computer left me pretty clueless, yet refuses to work. Has anyone an idea how identify the missing procedure?
N.B.: Additionally I ran the DependencyWalker which gave me the usual error message because it's deprecated (dependency walker gives me errors on the system that runs correctly) - which could indicate that all dependencies are found.

System.InvalidOperationException is scaring me

I recently reset my whole laptop. After the reset, I installed all of my programmes, including Visual Studio 2013 (I had 2012 on my last build). I then dumped my projects into the projects folder of 2013 and...I COULDN'T RUN MY PROJECT!!! I can view the code and the designer but I can't run it.
The error is from Application.Designer.vb and it is a "System.InvalidOperationException" error. Under additional information, it says "An error occured creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object. Highlighted is Me.MainForm = Global.MyApplicationName.Form1
I have checked msdn for answers about System.InvalidOperationException but haven't found any fixes that work.
I really don't know what to do and don't want to lose my application as I've spent a fair bit of time on it.
I have 2 suggestions to try
Open Application.Designer.vb and just delete the word Global.
Exclude (not delete) the mainform (Form1, apparently) from the project. Save it. Then include it again and go to Project Properties and make it the startup form again.
I've had similar issues (without the exception) when reorganizing pieces of large solutions into other namespaces. Often, I need to drill into the designers to change a ref to get it to run and it is usually removing 'Global' and/or adding the new Namespace ref. In your case, it sounds like a similar reference in the project did not get updated from 2012.
If that is the case, the second way should get VS to write back all the files in a manner that it likes.

CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Load report failed - VB.NET 2003

Anybody know why the below error exist?
CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Load report failed
From your comments about windows\Temp, that is caused by the application pool's identity not having access to c:\windows\Temp (and possibly to the reports folder).
You can solve this problem by giving the application pool credentials that do have the necessary permissions, or giving read write permissions to "Network User" to the c:\windows\temp folder (and again, possibly to the reports folder).
The reason why this folder is required is that the crystal runtime creates a dynamic copy of the report at runtime and places it in the %temp% folder. It is the temp folder copy (with a GUID appended to the original file name) that is shown in the web browser. This is by design and is a useful feature to ensure the live report is safe.
Following from this, you will have to do a proper cleanup after loading every report because they just stay there and fill up the temp folder!
Something like:
CrystalReportViewer1.Dispose(); // if using the viewer
CrystalReportViewer1 = null;
report.Close(); // I can't remember if this is part of the reportDocument class
report.Dispose();
report = null;
GC.Collect(); // crazy but true. Monitor the temp folder to see the effect
Reckface's answer was clear enough, but to add something up.
I managed to get it working using this:
protected void Page_Unload(object sender, EventArgs e)
{
if (reportDocument != null)
{
reportDocument.Close();
reportDocument.Dispose();
crystalReportViewer1.Dispose();
}
}
Doing so may cause issues with the buttons on the toolbar, they can't find the document path anymore because the document is disposed. In that case the document needs to load the path again during postbacks: source
This is a very old question, but I want to add that I got this error because the report was not embedded into the class library.
Solution: I removed the report from the project. I restarted Visual Studio 2022 and than added the crystal report again. This time it was added as an embedded resource.
Did you even bother to Google it? This is a common exception; there are hundreds of posts about it scattered around the intertubes.
The Crystal .NET runtime has famously cryptic error messages. This one just means that the .rpt file (or embedded report) could not be loaded. There are several possible root causes: wrong filename or path, security violation, you are not disposing of old reports properly and windows/temp is getting hogged up, etc.
Do some research. If you're still stuck, come back and elaborate on the problem (do any of your reports work, is this a web app?, what code are you using, etc.)

"File Not Found" in MSBuild Community Tasks -- Which File?

I'm trying to use the VssGet task of the MSBuild Community Tasks, and the error message "File or project not found" is beating me with a stick. I can't figure out what in particular the error message is referring to. Here's the task:
<LocalFilePath Include="C:\Documents and Settings\michaelc\My Documents\Visual Studio 2005\Projects\Astronom\Astronom.sln" />
<VssGet DatabasePath="\\ofmapoly003\Individual\michaelc\VSS\Astronom_VSS\srcsafe.ini"
Path="$/Astronom_VSS"
LocalPath="#(LocalFilePath)"
UserName="build" Password="build"
Recursive="True" />
If I write a Streamreader to read to either the database path or the local path, it succeeds fine. So the path to everything appears to be accessible. Any ideas?
Two thoughts. One, sometimes a type load exception manifests as a FNF - let's hope that's not it. But if the code is actually being honest, you can track the problem using Procmon or Filemon. Start one of those utilities and then run your task again. You should be able to track down a record of a file that couldn't be located.
#famoushamsandwich that's a great response -- I had not previously heard of procmon or filemon. Tried procmon on the problem, but even after sifting through the relevant output (my gosh the machine does a lot more stuff behind the screen than I was aware of) I couldn't find where a file I'm referencing wasn't being found.
Procmon and Filemon are good suggestions - just make sure you filter the results to only show errors. Otherwise the success messages will bury the problem entries. Also, you can filter out processes that are not at fault (either through the filter dialog or by right-clicking the entry and choosing "Exclude Process".)
A couple other thoughts:
In the LocalFilePath, you are specifying a single file as opposed to a folder. The task, on the other hand, specifies to get files recursively. Perhaps you need to remove "\Astronom.sln" from the LocalFilePath?
Is the build task being run under your account or another? It's possible you have a permissions issue
Do you already have a copy of the code pulled down in the same location? Perhaps there is a failure to overwrite an existing file/folder?