dnu restore fails on mac - asp.net-core

I download visual studio code for mac today. I tried to create a simple asp.net 5 web application following these instructions https://code.visualstudio.com/Docs/ASPnet5
When I open my web application folder in visual studio, it says I need to run a restore command.
I ran the dnu restore command just like the instructions tell me but it seems to always fail.
I receive different errors every time I run it. But most of them are like this one:
CACHE https://www.nuget.org/api/v2/package/System.Threading/4.0.10-beta-22816
SharpCompress.Common.ArchiveException: Could not find Zip file Directory at the end of the file. File may be corrupted.
Restore failed
There is a stack trace as well, but for brevity sake I'll omit it for now
Has anyone experienced this?

Try dnu restore --no-cache.
You may also need to remove previously downloaded files - check ~/.dnx/packages. I removed all files from that folder some time before trying the above. Also, see the comments below, if ~/.dnx/runtimes contains unexpected versions removing them may also work. Note that the current runtime version can be controlled using dnvm.
I never saw the NullReference exception, but I was getting the SharpCompress.Common.ArchiveException. I suspect there was a mismatch from what dnu thought was the cache state with the actual cache state (maybe something timed out the first time or something).

Related

nHibernate not creating Oracle driver in MSTests run on command line

I've been working on this particular issue for a couple weeks now, and I'm exceedingly frustrated. As such, I'll give all the information I can and hope for the best.
My team is working on building a new application. Here's the alphabet soup:
.Net 4.5.1
nHibernate 4.0.0.4000 with FluentNHibernate 2.0.3.0
Oracle 11g (Oracle.DataAccess 2.112.1.0, which has Copy Local set to true)
Visual Studio 2013 is the IDE
Windows 7 Professional
I am compiling the application as a 32-bit app, and I have confirmed that I have the 32bit version of Oracle installed.
We've written some tests for the NHibernate mappings, which we run through MSTest. When we run these through Visual Studio's test explorer, they all run properly and pass. The application itself also properly compiles and deploys as it should. We've verified the tests are running properly by checking the database between steps, so we're fairly sure that the tests themselves aren't the problem.
When we run MSTest through the command line though, we receive the following error:
Initialization method MyTests.Setup threw exception. NHibernate.HibernateException: NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.OracleDataClientDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed..
I've tried reinstalling Oracle to no effect. I've tried checking the machine.config file for errors (as suggested in other posts here on SO) and found none.
Our Fluent configuration is as follows:
OracleDataClientConfiguration.Oracle10
.ConnectionString(connectionString)
.Driver("NHibernate.Driver.OracleDataClientDriver")
.ShowSql()
.FormatSql();
The code I'm running on the command line is the following:
(cd to the directory where the test .dll is)
>"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" /testcontainer:MyTests.dll /test:UnitTests
I feel like I'm missing something here. Any ideas?
Update: Solution Found
So here's a weird one. I followed Fran's solution below and installed the Oracle.ManagedDataAccess package and changed the NHibernate driver in our configuration above to NHibernate.Driver.OracleManagedDataClientDriver. As per our quick comment-discussion, this lead to a new error:
Initialization method MyTests.Setup threw exception. NHibernate.HibernateException: NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.OracleManagedDataClientDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider
Fran then lead me to another SO question which encouraged me to check the Oracle configuration piece by piece. What better way to do this than create a test?
var x = new OracleConnection(connectionString);
x.Open();
Assert.IsTrue(x.State == System.Data.ConnectionState.Open);
x.Close();
Assert.IsFalse(x.State == System.Data.ConnectionState.Open);
In my quick attempt to run this test, I ran the whole collection of UnitTests with the script I'd mentioned above. Low and behold, every test passes!
Doing my due diligence, try the following
I comment out that test, clean, rebuild, and run the script again. Failures.
I return to the old Oracle driver and add that new test in. Clean, Rebuild, Run. Failures.
Add back the new Oracle driver, make sure the new test is still in. Run tests OTHER than the new test. Passes.
For some reason, the combination of the new driver and explicitly referencing it in a test seems to have resolved the issue. I'm open for any theories as to why, but I bet that qualifies as a new question.
I would stop using the bit specific version of the oracle drivers and move to the managed driver (https://www.nuget.org/packages/Oracle.ManagedDataAccess/). It is bit agnostic, and doesn't require you to install the Oracle client at all.
I actually found the solution to the problem, and it all has to do with how the Oracle.DataAccess.dll file gets loaded at runtime (Disclosure: I work with wadeb on the same project).
It seems that Oracle.DataAccess.dll was being searched for in every location on the server except the build output folder in the Jenkins workspace, and as such was pulling the DLL file from the GAC.
One of the file paths used to find the DLL file is the folder in which the "current executable" is located. In our case, the "current executable" was mstest.exe. Copying the Oracle.DataAccess.dll file to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE did the trick.
Did it work. Yes.
Was it a hack? Absolutely -- but now it works without having to upgrade to the managed Oracle drivers.
Our servers weren't using an Oracle client that worked with the managed driver, and it wasn't acceptable to have a broken continuous integration build until servers get upgraded.
I have got just the same error and I switched my tests to x64 and it works like a charm now:

DNU Restore results in multiple "The file exists" warning and errors and eventually dies

I recently updated my VS 2015 to Update 2 and also did a dnvm update-self. After taking these actions I'm now unable to perform dnu restores. I see the following error for almost every package from both myget and nuget
GET https://www.nuget.org/api/v2/FindPackagesById()?id='xunit.runner.dnx'
Warning: FindPackagesById: xunit.runner.dnx
The file exists.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='xunit.runner.dnx'
Error: FindPackagesById: xunit.runner.dnx
The file exists.
Eventually the entire operation bombs out. I've tried reinstalling my DNX's (currently using RC1-Update1), deleting all packages etc... to no avail. Any ideas are appreciated.
I found what resolved my issue here:
https://github.com/aspnet/dnx/issues/2505
Looks like my %userprofile%/AppData/Local/Temp folder got some possibly corrupted data in it that was confusing dnu restore. DNU restore caches packages here during processing. I purged the directory and DNU restore appears to be working well again.

What do I have to do to install the missing error messages cab file on a Windows CE Device?

I got this err msg while running my WindowsCE app:
...and so I copied NETCFv35.Messages.EN.wm.cab from my PC to my handheld, and tried to run/install that cab file on the handheld. I got:
So then I tried the same with NETCFv35.Messages.EN.cab. When I ran it on the handheld, it told me that it had already been installed:
...but I went ahead and "reinstalled." I'm not sure its default installation location, though, is the right place:
...so I copied it over again to the folder on the handheld where my .exe resides (NETCFv35.Messages.EN.cab had been deleted out of there after reinstalling). This time I made sure to install it into that same folder, rather than the seemingly random location it chose the first time:
Still, though, running the app shows me the same old "Which way did they go, George?" err msg about not being able to show me error messages (first screamshot above).
This makes me feel kind of Grimm, to the point where I'm thinking this is a pretty revoltin' development (no pun intended).
What do I need to do to be able to see the hidden err msgs?
UPDATE
This is what I got when I unpacked SYCCFA~1.001, renamed it System.SR.dll, and tried to add it as a reference to the project (it claims that it is not a .NET assembly...???):
I tried the same thing with NETCFv35.Messages.EN.wm.cab, with the same results (it looks like the same file - same date, same size...so why the name diff?)
The error messages are in a single file called "System.SR.dll". The CAB simply installs that and puts it into the GAC. You get an "already installed" error because it sees it in the registry, though it doesn't mean the file is actually there.
You can simply extract the DLL from the cab with a zip extractor (I use WinRAR, but whatever). For example, If I open this file:
C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\Diagnostics\NETCFv35.Messages.EN.cab
It has a few things in it. SYCCFA~1.001 is the DLL. Pull it out, rename it to System.SR.dll and add it as a reference in your project. Studio will deploy it when you run and boom, you're cooking with butter.

Keep getting : Debug error BC31019 : Unable to write to output file 'path/form.exe System Error &H80070005& VB.NET

I'm using Visual Studio Professional 2013 and I'm doing some very basic windows forms application.
A month ago, I could do everything I wanted without any problem. But I started some new projects today and for absolutely no reasons, I keep getting this error message when I come to debug or compile:
Debug error BC31019 : Unable to write to output file 'path/form.exe System Error &H80070005&
It can happen simply by changing the size of a textbox or modifying the text content in a label... It's very random... And I can even do an undo (ctrl+z) and then I can debug again, but if I try again to do the thing I did that brought the error message, the same message pops again as I try to run.
After reading a little about the subject, I realized that it was because the .exe file became in read-only mode and when I try to remove it, windows wont let me.
The only thing I can do if I really want to continue, is to restart my computer every times it happens. Then I can continue just like normal as my .exe file is no longer in read-only...
I tried tor run a sfc/scannow in my command prompt to see if i had any problems with my frameworks but everything was fine.
Since, it is when i restart my pc that the bug disapears, isn't anything i can do or run somewhere to do the same thing. I need to find why the exe file goes to read-only for nothing and how to get it back to normal without having to restart my pc every time...
Please help me!
thank you
I came across the same issue and it was related to having a command line argument that VS could not find, then when i clicked stop debugging I ended up in this situation as it seemed VS kept a process running.
I could see this process in task manager but could not end it (it started with the same name as my app)
I found closing VS would release this process.
Restarting VS it would then work ok again.
there may be other ways to reproduce the issue but restarting VS seems to release the file and allow you to continue.
I set the exe properties to Read/write. No effect, but when I set app properties/settings to "Always on top" = False the issue went away and is still away.

Error LGHT0301: Failed to open the database

I'm using WiX 3.5. Recently, the following WiX error started occurring frequently on the build server:
light.exe (,): error LGHT0301: Failed to open the database. During validation, this most commonly happens when attempting to open a database using an unsupported code page or a file that is not a valid Windows Installer database. Please use a different code page in Module/#Codepage, Package/#SummaryCodepage, Product/#Codepage, or WixLocalization/#Codepage; or make sure you provide the path to a valid Windows Installer database.
Which "database" does the error refer to? (None of the WiX source files have changed in a long time, so I doubt it's a code page problem.)
Other people have reported that this error may be caused by Trend Micro Office Scan, which is indeed installed on the build server. I asked the system administrator to exclude the build directories from the scan, but this error still occurs. How can I determine whether the virus scanner is the culprit? (The error doesn't always occur, so if I disable the virus scanner and the next build succeeds, I still don't know whether the error has gone away permanently.)
The "Disable the ICE validation" worked for me - just a setting through Visual Studio 2012 in the .Setup.
After studying the WiX source code and running Process Monitor, I found that excluding the build directories from the virus scan is insufficient.
Explanation: When light.exe runs, it creates the target MSI file in a temporary directory. (This file is the database that the LGHT0301 error message refers to.) After light.exe closes the MSI file, ntrtscan.exe opens the MSI file for read access and read-only sharing. Later, in the database validation step, light.exe tries to reopen the MSI file for read/write access, and a sharing violation occurs.
Solution: Exclude the temporary directory from the real-time virus scan. On Windows Server 2008, for example, this directory is C:\Users\«username»\AppData\Local\Temp.
This is a common problem with build processes and antivirus. The scanner will detect the new MSI package and try to scan it. Meanwhile the build process also tries to validate it by running the Internal Consistency Evaluators (ICE) suite and you get a failure because the database has a mutex on it.
You should just remove the virus scan from your build output folders. Alternatively decouple the validation from the Light command so that the antivirus scan relinquishes the MSI handle before you run the ICE validation.
I had the same problem which was actually really related to codepages and language settings of my system.
Adding English input language in Windows' regional settings solved the problem on my German Windows installation.
The real cause was Trend Micro real time scanning!
(The following is only for historical reference)
I followed #Michael Liu answer and solved the problem
I had the same problem.
I am not referring to Codepage (or SummaryCodepage) in any of those tags, or in fact anywhere in the WXS. Putting Codepage="1252" didn't change anything.
Finally, I tried adding
encoding="utf-8"
to the XML tag which previously only had a version='1.0' attribute. This fixed the problem, as described in "Failed to open the database" error. - SOLVED
It was also the antivirus program for me.
An easy way to check if the problem is related to the anti-virus program is to disable the ICE validation in the WiX project setting (using version 3.7). This worked for me, and is a permanent setting now, since in our company you can't change the setting of the antivirus software.
This is the most common error I found while using WiX. The easiest solution for this is go to Properties of your project → Tool Settings → (Check) Suppress ICE Validation.