Visual Studio 2019 Xamarin Dotfuscator CE Config File Creation Problem - xamarin

I have followed the instructions at https://www.preemptive.com/dotfuscator/ce/docs/help/getting_started_xamarin.html#setup-targets and verified the accuracy multiple times. It says the first build will create DotfuscatorConfig.xml but it fails with Error 1. Then it says to set verbosity to Normal, so I did, but still no revelation why it won't create the file. I can change the build back to Debug and it builds fine, but changing back to release produces the same two errors. Has anyone experienced this and solved it?
Severity Code Description Project File Line Suppression State
Error The command ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscator.exe" /p:InDir="obj\Release\100\DotfuscatorXamarin\dfin",OutDir="obj\Release\100\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\Release" "obj\Release\100\DotfuscatorXamarin\Template.dfconfig" /in:+"${configdir}${InDir}\WetYourWhistle.Android.dll",+"${configdir}${InDir}\WetYourWhistle.dll" /makeconfig:"DotfuscatorConfig.xml"" exited with code 1. WetYourWhistle.Android C:\Users\leuol\source\repos\WetYourWhistle\PreEmptive.Dotfuscator.Xamarin\PreEmptive.Dotfuscator.Xamarin.targets 508
Severity Code Description Project File Line Suppression State
Error The "_DotfuscatorXamarin_SetProjectPropsTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'C:\Users\leuol\source\repos\WetYourWhistle\WetYourWhistle\WetYourWhistle.Android\DotfuscatorConfig.xml'.
File name: 'C:\Users\leuol\source\repos\WetYourWhistle\WetYourWhistle\WetYourWhistle.Android\DotfuscatorConfig.xml'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.FinishInitUriString()
at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at System.Xml.Linq.XDocument.Load(String uri)
at InlineCode._DotfuscatorXamarin_SetProjectPropsTask.Execute() in c:\Users\leuol\AppData\Local\Temp\r0wqtkdr\r0wqtkdr.0.cs:line 93
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() WetYourWhistle.Android C:\Users\leuol\source\repos\WetYourWhistle\PreEmptive.Dotfuscator.Xamarin\PreEmptive.Dotfuscator.Xamarin.targets 520
Error The command ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscator.exe" /p:InDir="obj\Release\100\DotfuscatorXamarin\dfin",OutDir="obj\Release\100\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\Release" "obj\Release\100\DotfuscatorXamarin\Template.dfconfig" /in:+"${configdir}${InDir}\WetYourWhistle.Android.dll",+"${configdir}${InDir}\WetYourWhistle.dll" /makeconfig:"DotfuscatorConfig.xml"" exited with code 1. WetYourWhistle.Android C:\Users\leuol\source\repos\WetYourWhistle\PreEmptive.Dotfuscator.Xamarin\PreEmptive.Dotfuscator.Xamarin.targets 508
UPDATE - Now the code is compiling without error but still will not produce the DotfuscatorConfig.xml file. Not sure what else to try and it appears that nobody else knows either.

The solution is to temporary change the command dotfuscator.exe to dotfuscatorUI.exe :
<PropertyGroup>
<DotfuscatorXamarinConfigFileName>DotfuscatorConfig.xml</DotfuscatorXamarinConfigFileNam
<DotfuscatorXamarinCliPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorUI.exe</DotfuscatorXamarinCliPath>
<DotfuscatorGenerateConfigFileIfMissing>true</DotfuscatorGenerateConfigFileIfMissing>
<DotfuscatorEnabled>true</DotfuscatorEnabled>
<DotfuscatorXamarinEnabled Condition="'$(Configuration)' == 'Release'">true</DotfuscatorXamarinEnabled>
</PropertyGroup>
<Import Project="../../PreEmptive.Dotfuscator.Xamarin/PreEmptive.Dotfuscator.Xamarin.targets" />
Then start build. The dotfuscator UI starts with a window:
Show Image
Then press "Build". After it finishes, close then window by clicking "x" on top right. Then the output on Visual Studio shows a successful result:
Build started: Project: [AppName].Android, Configuration: Release Any CPU ------
[AppName].Android -> D:\Users\[UserName]\source\repos\[FolderName]\[AppName]\[AppName].Android\bin\Release\[AppName].Android.dll
Running Dotfuscator with a new config file based on project references...
Finished running Dotfuscator with a new config file.
D:\Users\[UserName]\source\repos\[FolderName]\[AppName]\[AppName].Android\[AppName].Android.csproj : warning : A new Dotfuscator config file was generated because it did not exist: 'DotfuscatorConfig.xml'.
You can see dotfuscatorconfig.xml is created at a folder [AppName].Android.
Then revert back from dotfuscatorUI.exe to dotfuscator.exe .
<PropertyGroup>
<DotfuscatorXamarinConfigFileName>DotfuscatorConfig.xml</DotfuscatorXamarinConfigFileNam
<DotfuscatorXamarinCliPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscator.exe</DotfuscatorXamarinCliPath>
<DotfuscatorGenerateConfigFileIfMissing>true</DotfuscatorGenerateConfigFileIfMissing>
<DotfuscatorEnabled>true</DotfuscatorEnabled>
<DotfuscatorXamarinEnabled Condition="'$(Configuration)' == 'Release'">true</DotfuscatorXamarinEnabled>
</PropertyGroup>
<Import Project="../../PreEmptive.Dotfuscator.Xamarin/PreEmptive.Dotfuscator.Xamarin.targets" />
Then the build should work without a UI popup.

Related

Powershell terminal issues in both vscode and visual studio 2022

So my project is creating a web app and i have tried using both vs code and visual studio 2022 and with visual studio i am not familiar on how to add webclass libraries with it and cannot use the terminal, I have created new projects and run as admin and i have the same error no matter the powershell command.
PS C:\CPSC1517ASP\sandbox\src> dotnet new sln -n solution
Error reading or writing history file 'C:\Users\jonav\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt': Access to the path is denied.
umTemplate "Solution File" could not be created.
Failed to create template.
Details: Error while processing file /content/Solution/Solution1.sln
System.IO.FileNotFoundException: Could not find file 'C:\CPSC1517ASP\sandbox\src\solution.sln'.
File name: 'C:\CPSC1517ASP\sandbox\src\solution.sln'
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.File.Create(String path)
at Microsoft.TemplateEngine.Utils.PhysicalFileSystem.CreateFile(String path)
at Microsoft.TemplateEngine.Core.Util.Orchestrator.ProcessFile(IFile sourceFile, String sourceRel, String targetDir, IGlobalRunSpec spec, IProcessor fallback, IEnumerable

Error when building Android Project on Window 10

When building for Android I keep having this error:
Severity Code Description Project File Line Suppression State
Error Failed to create JavaTypeInfo for class: Android.Support.V4.View.Accessibility.AccessibilityManagerCompat/IAccessibilityStateChangeListenerImplementor due to System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Iain Smith\Documents\Developer\Work\Clients\Client1\Project1\Xamarin.Dev.Playground\Source\Client1.Playground.Android\obj\Debug\90\android\src\mono\android\support\v4\view\accessibility\AccessibilityManagerCompat_AccessibilityStateChangeListenerImplementor.java'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at Xamarin.Android.Tools.Files.CopyIfStreamChanged(Stream stream, String destination)
at Xamarin.Android.Tasks.Generator.CreateJavaSources(TaskLoggingHelper log, IEnumerable`1 javaTypes, String outputPath, String applicationJavaClass, Boolean useSharedRuntime, Boolean generateOnCreateOverrides, Boolean hasExportReference) Client1.Playground.Android
What is causing it? How do I fix it? Doesn't seem to happen on the CI builds.
Here's a few methods you can use to fix MAX_PATH length issues:
Within a Xamarin.Android .csproj:
<UseShortFileNames>True</UseShortFileNames> - Forces the build process to use shorter path names.
<IntermediateOutputPath>C:\Projects\MyApp</IntermediateOutputPath> - Specifies a common intermediate output root to make a shorter path.
Changing the group policy:
Enable Win32 Long Path Support (Supported in Visual Studio 2019+): https://blogs.msdn.microsoft.com/jeremykuhne/2016/07/30/net-4-6-2-and-long-paths-on-windows-10/
This is due to the Max Path length on Windows, Changed my directory from:
C:\Users\Iain Smith\Documents\Developer\Work\Clients\Client1\Project1\Xamarin.Dev.Playground\Source\Client1.Playground.Android\
to:
C:\Developer\Work\Clients\Client1\Project1\Xamarin.Dev.Playground\Source\Client1.Playground.Android\

System.IO.IOException during the build process in VisualStudio 2017

I'm working on a Hololens application using Unity 2018.2.20f1. I'm building the application for UWP from Unity without a problem. However, after opening up the generated solution in the VisualStudio 2017 (Community Edition) and trying to build it, the build process fails with the following errors:
Severity Code Description Project File Line Suppression State
Error MSB3073 The command ""D:\Projects\VSProjects\VirtualPrague\Il2CppOutputProject\\IL2CPP\build\il2cpp.exe" --libil2cpp-static --compile-cpp -architecture=x86 -configuration=Release -platform=winrt -outputpath="D:\Projects\VSProjects\VirtualPrague\\build\bin\Win32\Release\GameAssembly.dll" --data-folder="D:\Projects\VSProjects\VirtualPrague\\build\bin\Win32\Release\\" -cachedirectory="D:\Projects\VSProjects\VirtualPrague\\build\obj\il2cppOutputProject\Win32\Release\\" -generatedcppdir="D:\Projects\VSProjects\VirtualPrague\Il2CppOutputProject\\Source" --additional-defines=WINDOWS_UWP --additional-defines=UNITY_UWP --additional-defines=UNITY_WSA_10_0 --additional-defines=UNITY_WSA --additional-defines=UNITY_WINRT --additional-defines=PLATFORM_WINRT -dotnetprofile=unityjit -verbose --map-file-parser="D:\Projects\VSProjects\VirtualPrague\Il2CppOutputProject\\IL2CPP\MapFileParser\MapFileParser.exe"" exited with code -532462766. Il2CppOutputProject C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 44
and
Severity Code Description Project File Line Suppression State
Error LNK1181 cannot open input file 'D:\Projects\VSProjects\VirtualPrague\build\bin\Win32\Release\GameAssembly.lib' VirtualPrague D:\Projects\VSProjects\VirtualPrague\VirtualPrague\LINK 1
In the output there are multiple exceptions, similar to this one:
1>il2cpp.exe didn't catch exception: System.IO.IOException: The process cannot access the file 'C:\Users\dev\AppData\Local\Temp\tmpDE97.tmp' because it is being used by another process.
1> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1> at System.IO.File.InternalDelete(String path, Boolean checkHost)
1> at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
1> at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
1> at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
1> at il2cpp.Program.DoRun(String[] args)
1> at il2cpp.Program.Run(String[] args)
1> at il2cpp.Program.Main(String[] args)
The exceptions are the same but were thrown for different files. I tried to reinstall the Visual Studio and managed to get a build. The next day I turned on the PC and this error was back. I stopped all of the VS instances and processed from the task manager, deleted all of the files from the Temp folder and managed to get a build a couple more times. Then this error came back.
From what I can tell, during the build process, Visual Studio creates some *.tmp files and for some reason thinks that another process is using it.
Any idea why this is happening and how can it be solved?
Thanks a lot!
Edit: So here is what I did so far (this is more of a work around rather then a solution)
Uninstall vs and unity
Clear the registry with ccleaner and Advanced Uninstaller Pro
Install vs and Unity
Every time I want to get a build I,
Close all of vs instances
Clear Temp folder (C:\Users\dev\AppData\Local\Temp)
Delete previous vs solution
Build from Unity
Run vs as Administrator
Build and deploy the solution from vs
And it works for the most the time. Also, changing the solution configuration (from debug to release and vice versa) helps sometimes.

SSIS 2012 in Visual Studio throws error "insufficient memory"

When I try to run any SSIS 2012 packages in Visual Studio, it throws the error shown below; all the packages were running fine before, but none is running now:
Insufficient memory to continue the execution of the program. (Microsoft Visual Studio)
Program Location:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.DataWarehouse.VsIntegration.Interop.NativeMethods.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
at Microsoft.DataWarehouse.VsIntegration.Shell.DataWarehouseOutputWindowFactory.CreateOutputWindow(Guid windowGuid, String windowCaption)
at Microsoft.DataWarehouse.VsIntegration.Shell.DataWarehouseOutputWindowFactory.GetStandardOutputWindow(StandardOutputWindow standardOutputWindow)
at Microsoft.DataTransformationServices.Project.DtsPackagesFolderProjectFeature.ExecuteTaskOrPackage(ProjectItem prjItem, String taskPath)
Can someone help?

How does Microsoft Test Manager run automated Unit tests?

I have associated some test cases with unit tests in a project. That project is build and copied to a drop location on a share. When I go to run these tests I'm getting a lot of failures due to System.DllNotFoundExceptions from an unmanaged DLL that is included as part of these tests?
Does anyone know why this is happening? I have a lab environment setup and the tests are (supposedly) running on that machine. What is the workflow for when these tests run? Does the TestController copy the unit test DLLs somewhere locally on the machine in the lab environment or is it trying to run directly from the build folder?
Here is the stack trace for the error. Note that c:\Builds\ is NOT on the test machine which seems quite suspect to me.
Test method OutputProcessing.Integration.PanaceaOutputG1.ReactorCoreSimulationResults threw exception:
System.DllNotFoundException: Unable to load DLL 'ge.gnf.cedar06.c.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Gnf.Cedar.NativeMethods.ATACHF(Int32& fileCode, String fileName, Int32& openMode, Int32[] stat)
Gnf.Cedar.ManagedMethods.Atachf(String fileName, FileAccess access, Int32[] stat)
Gnf.Cedar.Cypress.CedarFile.OpenCedarFile(String path, FileAccess access, FileSizeHint hint, AuditMode auditMode, ChainingOrderOption chainingOrder, Boolean createIfMissing)
Gnf.Cedar.Cypress.CedarFile..ctor(String path, FileMode mode, FileAccess access, FileSizeHint hint, AuditMode auditMode, ChainingOrderOption chainingOrder)
Gnf.Cedar.Cypress.CedarFile..ctor(String path, FileMode mode, FileAccess access)
GE.GNF.Acumen.Cedar.DataAccess.CedarRepository.GetCedarFile() in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Cedar\Cedar.DataAccess\CedarRepository.cs: line 67
GE.GNF.Acumen.Cedar.DataAccess.CedarRepository..ctor(String fullFilePath) in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Cedar\Cedar.DataAccess\CedarRepository.cs: line 40
GE.GNF.Acumen.Cedar.DataAccess.CedarRepository..ctor(String fullFilePath, String qualifier) in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Cedar\Cedar.DataAccess\CedarRepository.cs: line 43
OutputProcessing.Integration.PanaceaOutputG1.ReactorCoreSimulationResults() in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Auto Integration Tests\OutputProcessing.Integration\PanaceaOutputG1.cs: line 58
The DLLs containing test implementation will be copied to the test machine.
You can activate Test Agent logs and check in the log file which files have been deployed.
To activate these logs:
Go to the C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE folder
(this is the path for Test Agent 2012, if you are using older version the path with be slightly
different).
Change file QTAgentService.exe.config (set the EqtTraceLevel to "4" and CreateTraceListener to "yes"):
<configuration>
<system.diagnostics>
<switches>
<!-- You must use integral values for "value".
Use 0 for off, 1 for error, 2 for warn, 3 for info, and 4 for verbose. -->
<add name="EqtTraceLevel" value="4" />
</switches>
</system.diagnostics>
<appSettings>
<add key="CreateTraceListener" value="yes"/>
</appSettings>
</configuration>
Restart Test Agent and you will find the file VSTTAgent.log created in the same directory.
Start your tests now and then check this logfile. You will find entries like this one (just search for "Copying remote file":
I, 5856, 4, 2014/01/31, 09:50:58.283, <computer name>\QTAgentService.exe, Copying remote file: C:\Users\<tfs build user>\AppData\Local\VSEQT\QTController\<test run>\Deployment\<your DLL file> to: C:\Users\<local user>\AppData\Local\VSEQT\QTAgent\<test run>\<test configuration>\Deployment\<your DLL file>
Now you can check if all your DLLs have been deployed.
Note: The source path is located on the machine Test Controller is running on, the destination path is located on the test machine (where Test Agent is running).
As much as I know unmanaged DLLs will not be deployed along with "unit tests DLLs" so you will have to make sure they will be deployed.
You can do it using Test Settings:

Resources