I am using MSTest to run my unit test and for some reason, all the test are failing with the following error message
Unit Test Adapter threw exception:
Data source 'XXX.YYY.DriverData.aboutThemContactInformationFlows' cannot be found in the test configuration settings..
But the test are running fine in my local machine. Not sure whats going wrong.
I am having visual studio 2015 in my test machine as well in my dev machine.
The same setting is running fine in my dev machine.
Read other thread that points to missing app.config file in the test project. I do have a app.config file in the test project.
Is there any thing which I am missing. Below is the test settings file
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="UITestSettings" id="1623gdcf4-f2af-496f-b65h4-fe25w6c4e49cb" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a remote test run.</Description>
<Deployment>
<DeploymentItem filename="XXX\TestData\LocationData.xls" />
<DeploymentItem filename="XXX\TestData\UITestData.xls" />
</Deployment>
<Execution parallelTestCount="0">
<Timeouts runTimeout="36610000" testTimeout="36610000" />
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdcs9d9-ddb5-4fa4-a97d-d965ccdfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
<WebTestRunConfiguration testTypeId="4ess7599fa-5ecb-43e9-a887-cd63cfdf72d207">
<Browser name="Internet Explorer 9.0" MaxConnections="6">
<Headers>
<Header name="User-Agent" value="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" />
<Header name="Accept" value="*/*" />
<Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
<Header name="Accept-Encoding" value="GZIP" />
</Headers>
</Browser>
</WebTestRunConfiguration>
</TestTypeSpecific>
<AgentRule name="LocalMachineDefaultRole">
</AgentRule>
</Execution>
<Properties>
<Property name="TestSettingsUIType" value="UnitTest" />
</Properties>
</TestSettings>
Well, the dev machine is a Win10 machine and the test machine is also win 10 machine.
Help pls. Any information would be much much helpful
It may or may not help you now, but I've just encountered the same problem with MSTestHacks and in my case, as in yours, I already had an app.config which is the suggested solution in various GitHub issues. I tracked it down to having made an assumption about the fully qualified namespace that you need in the DataSource attribute.
In my case I had assumed the namespace was
FrontOffice.BusinessLogicLayer.Tests.Queries.GenericTools.GetToolsForPartnerQueryTests.TestCases
This is because the project was named FrontOffice.BusinessLogicLayer.Tests. But when I checked the Assembly name and Root namespace fields in the project properties I discovered that they had been set as FrontOffice.BusinessLogicLayerTests.
Once I corrected this it ran as expected. It seems really obvious but check your namespaces carefully as unless you created them there's always a chance someone else did the (to my mind) stupid trick of having projects whose names do not match their namespaces.
Related
BACKGROUND:
I'm having a problem with a ClickOnce WindowsForms NET 4.8 App that now is composed of a Solution with 2 projects.
All began after auto generated certificate expired after 2 y. I do not know if it is relevant, but at the beginning it was only one project that I split in two and used the same generated key for both.
So, I generated new on signing Tab, with Create Test Certificate (wish I had known about extend life of old one... but now it is deleted) and, because they are two projects, with 2 Apps (but I'm using Model and Services from the other) I generated one Test Certificate for each.
At Signing Tab the option sign the ClickOnce manifests is checked, but not the Sign the assembly (neither before were).
I can build, run, debug and use it normally; but, if try to Publish to the same place as before I receive the msg:
The application is signed with a different key than the existing
application on the server. Do you want to overwrite it?
As it is a development phase still, I do not care about it and overwrote it.
CURRENT PROBLEM:
App is Published, but it not starts, and gives no clue or msg.
At the Program.cs I have, of course:
Static async Task Main()
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += ApplicationOnThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
//...
}
How I tried to investigate:
So, I changed my Output folder and of course there is no more ... application is signed with a different key than ... but the App still doesn't starts and gives no msg. Same behavior in two other Windows 10 PCs.
I'm using VS 2022 64 bits and Windows 10, both fully updated as always.
After I saw this I changed to Create application without a manifest to no avail.
I went to the event viewer console and there is two error msgs, at same TimeStamp:
The first one is:
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2022-03-18T14:52:57.3515638Z" />
<EventRecordID>226871</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>Computer-NAME</Computer>
<Security />
</System>
- <EventData>
<Data>Application: applaunch.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Information: exception code e0434352, exception address 00007FFA01334F69 Stack:</Data>
</EventData>
</Event>
The second one:
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>100</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2022-03-18T14:52:57.5775648Z" />
<EventRecordID>226872</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>Computer-NAME</Computer>
<Security />
</System>
- <EventData>
<Data>applaunch.exe</Data>
<Data>4.8.4084.0</Data>
<Data>5dda4211</Data>
<Data>KERNELBASE.dll</Data>
<Data>10.0.19041.1566</Data>
<Data>0833f2d4</Data>
<Data>e0434352</Data>
<Data>0000000000034f69</Data>
<Data>13368</Data>
<Data>01d83ad7dade31c5</Data>
<Data>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\applaunch.exe</Data>
<Data>C:\WINDOWS\System32\KERNELBASE.dll</Data>
<Data>507e79be-c718-4d23-bab8-f153b4601c3b</Data>
<Data />
<Data />
</EventData>
</Event>
Lastly, I unchecked the Sign the ClickOnce manifests; the behavior remains the same and the vanilla error msgs at Event Viewer too.
If I understand correctly, because of none my global error handlers catch it, I'm assuming that the error is firing before any of my code is even loaded in memory and it is related to the certificate changing, but I'm not sure. I'm lost in how to further investigate it. Any directions?
TIA
EDIT 1:
To further investigate I enabled the verbose installation.log as per these instructions.
To my surprise both the functioning version (published with the non-expired key) and the new one (with the new key) output the same installation.log. With this weary information I went to Published folders (%AppData%\Local\Apps\2.0...) and to my further surprise I could instantiate not only the Operational App - with a different behavior regarding displayed version number - but could initiate the missing new version App from its Published folder.
And yes, I correct filled Publisher name and Product name.
After so much time entangled with this error, I:
followed the advise of this thread and I created entirely different solution/projects, from scratch, and I copied all my files (.cs, forms, assets...) to the new one.
adjusted namespaces and installed the needed Nuget packages and references.
signed the ClickOnce manifests with the Create Test Certificate as usual, but few minutes after I changed the duration of .pfk key to several years; it must be done BEFORE it ever expires, and I'll forget for sure; so, did it in sequence because, if after, no effect at all...
I'm back to the game, publishing again!
PS: I never more will let a temporary certificate expires...
I haven't published my cloud service in quite awhile and I am not usually the one to do it as I have taken over a project. When I initially tried to publish it eventually failed and said my settings are probably invalid so I downloaded a new copy of the ServiceConfiguration.Cloud.cscfg file. The only thing different that I could see is new settings for RemoteDebugging:
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector.Version" value="2.3" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.ClientThumbprint" value="X" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.ServerThumbprint" ...
With the new settings however I am unable to build. It complains that the RemoteDebugger is specified but not declared the ServiceDefinition file.
I thought adding a module would help but it doesn't find it by the name RemoteDebugger. Any help would be greatly appreciated.
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
...tried a few different possible names here
</Imports>
I don't see any way to download this ServiceDefinition file and looking at this post:
How to enable remote debugging in Azure Cloud Service package built by MSBuild
...I see a bunch of settings in the ServiceDefinition file that are supposed to be inserted automatically. However I have no idea what these settings should be or how to generate them.
I have built an installer for my application with wix. I am also using an automatic updater so the user can update the software. The problem I am having is for the updater to work it needs to run its exe and close my application and restart my application after it has finished. When the updater starts up, it needs elevated permissions to run. I am wondering if there is a way to permanently grant the updater exe elevated permissions on install since it has to be installed by an administrator to begin with, saving the administrator from being present every time an update needs to be done?
It would be nice for the user to click update and not have to bother their IT department to get an updated version of our software.
Without being a member of the windows build team you only have two options
Start your program from another program that was already running that has administrator privileges
Make it so your update process does not require administrative privileges.
The only real way to perform #1 is to have a windows service that runs in the background and executes the downloaded update package as an administrative user, this process is hard to do "right" without leaving security holes in the end users system that malware (or users that want to get around IT's restrictions) could exploit.
Option #2 is the better option, and is what many popular software packages use. The way to accomplish this is to either change the permissions of your folder inside ProgramFiles to allow the Authenticated Users group to have write privileges. This is not the optimal solution but likely the easiest to implement. Another way to accomplish this is install the updateable resources in to a folder that your user has write access to by default, for example the %LocalAppData% folder (which is what Chrome does (I think) and any applications deployed with ClickOnce)
You need to add a manifest to every executable that always needs to run elevated. Here is a sample app.manifest file:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplicationName" />
<description>My application description.</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
</application>
</compatibility>
</asmv1:assembly>
The relevant setting for this in the manifest is:
level="requireAdministrator"
You just need to add an app.manifest file to your project, and then set the manifest in the Properties tab for the project to the new file instead of using the default manifest generated by the compiler.
The Windows account running the process still requires administrative privileges however for the process to run with these privileges.
EDIT: I would still like an answer to this question if anyone can provide one, however I have decided to split out the non-administrative part of this project into another project which will call this project as required.
I have a project which manipulates some registry keys under HKLM - which obviously requires elevation. The application knows when it needs this elevation and will re-launch itself with runas to get elevation.
In the development environment this works fine, and the application also runs fine on intended targets in this form.
When I pump the project through a VS2010 setup project and install the project on the target system, the EXE gets marked as requiring elevation and requests it whenever it gets run before the application logic determines if it needs it.
I have searched for an hour or so and found nothing which relates, though I suspect the power of my search terms is insufficiently strong (or I lack the right ones) to find an appropriate result.
How can I stop the setup project from marking the executable as requiring elevation?
Subsequent to the comment below I added a custom manifest to the project with the same result, the manifest looked right to me:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
</application>
</compatibility>
</asmv1:assembly>
Here's the output of the project's build (in the obj folder since that's what's being pulled in by the setup project):
http://i.stack.imgur.com/elrQh.png
The outwardly obvious thing is the lack of the UAC shield on the executable. After building the setup project, then installing it via the resultant MSI, the installed executable is like this:
http://i.stack.imgur.com/A33qz.png
Noting the now existing UAC shield.
Before adding the custom manifest, it was set to use a default one (which I suspect has the same content).
i have developed a web servcies in my local system with name (inbox service).
when i did add web reference
i got like this in my web service descpition file
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://localhost:1518/popup-message/InboxService.asmx?wsdl" docRef="http://localhost:1518/popup-message/InboxService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://localhost:1518/popup-message/InboxService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:InboxServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://localhost:1518/popup-message/InboxService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:InboxServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>
but when i deploy my application (project) on server. i have my project url like this
ex: http://abc.com,
now my webservice is like this http://localhost:1518/popup-message/InboxService.asmx.
if i tied to call method from my page it is not working what is issue here
anyhelp would be great.
thank you
Have you edited the url in web.config / app.config? Note that if the web-reference is in a dll (not the web layer itself) you might not even see the setting in web.config; in such cases, copy the setting from the dll's config in VS - into web.config. Note that dll configs don't really do anything, except provide somewhere to copy/paste that value from.