Unity-Photon Voice-Serialization Weaver Build error - unity3d

I'm trying to add Photon Voice to my Unity app for Windows 10, but I'm getting an error when I try to build the app from Visual Studio.
System.Exception: Exception while processing UnityVoiceFrontend UnityVoiceFrontend PhotonVoiceNetwork::client, error Failed to resolve assembly: 'Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at Unity.Serialization.Weaver.MethodEmitterBase.WillUnitySerialize(FieldDefinition fieldDefinition)
at Unity.Serialization.Weaver.SerializeMethodEmitterBase.ShouldProcess(FieldDefinition fieldDefinition)
at System.Linq.Enumerable.<>c__DisplayClass6_0`1.<CombinePredicates>b__0(TSource x)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Unity.Serialization.Weaver.MethodEmitterBase.EmitMethodBody()
at Unity.Serialization.Weaver.MethodEmitterBase.CreateMethodDef(String methodName)
at Unity.Serialization.Weaver.SerializeMethodEmitter.SerializeMethodDefinitionFor(TypeDefinition typeDef, SerializationBridgeProvider serializationBridgeProvider)
at Unity.Serialization.Weaver.SerializationWeaver.AddSerializeMethod()
at Unity.Serialization.Weaver.SerializationWeaver.Weave()
at usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition, ReaderParameters readerParameters)
at usw.Weaver.Weave()
at usw.Program.RunProgram(ConversionOptions options)
at usw.Program.Main(String[] args)
Am I missing something or did I not do the set up correctly?
I followed the instructions here

Related

Fatal error in Unity CIL Linker - conflict with a System folder

guys.
So, the issue is, when I'm trying to make an IL2CPP build, I recieve this:
Building Library\Bee\artifacts\WinPlayerBuildProgram\ManagedStripped failed with output:
C:\Programms\Unity\Editors\2021.2.11f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe #Library\Bee\artifacts\rsp\16461770786374037127.rsp
Fatal error in Unity CIL Linker
Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: System.Windows.Forms.XplatUIX11.SetDisplay(IntPtr): Error processing method 'System.Windows.Forms.XplatUIX11.SetDisplay(IntPtr)' in assembly 'System.Windows.Forms.dll'
---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'
at Unity.IL2CPP.Common.MissingMethodStubber.GetTypeModule(TypeReference type, IEnumerable`1 assemblies)
at Unity.Linker.Steps.AddUnresolvedStubsStep.MarkAssemblyOfType(UnityLinkContext context, TypeReference type)
at Unity.Linker.Steps.Marking.UnresolvedStubMarking.HandleUnresolvedType(TypeReference reference)
at Unity.Linker.Steps.UnityMarkStep.HandleUnresolvedType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Unity.Linker.Steps.UnityMarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason)
at Unity.Linker.Steps.UnityMarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context)
at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Unity.Linker.UnityDriver.UnityRun(Boolean noProfilerAllowed, ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger, Boolean noProfilerAllowed)
at Unity.Linker.UnityDriver.RunDriver()
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
I've been searching for an answer to this issue, but the fact it has a conflict with a System folder just kills me.
The Unity version is 2021.2.11f1, Mono build creates just fine.
Could anyone please help?
Please look in your project if you have included System.Windows.Forms.dll in case not please add it.
Also I think that System.Windows.Forms.dll it's not suported by Unity so please search if you have any reference to it and replace it in that case.
I'm almost for sure that is an issue related to references maybe it fixes including all the dlls that are asked.
There is a package called NuGetForUnity that it might help.

How could I load MongoDB Client and start a connection inside F# Interactive?

I'm using netcore 3.1, on macOS Catalina 10.15.6, and JetBrains Rider 2020.2 .
I tried starting a MongoDB connection with the following:
#r "../../../.nuget/packages/dnsclient/1.3.1/lib/net471/DnsClient.dll"
#r "../../../.nuget/packages/mongodb.driver.core/2.11.0/lib/net452/MongoDB.Driver.Core.dll"
#r "../../../.nuget/packages/mongodb.bson/2.11.0/lib/net452/MongoDB.Bson.dll"
#r "../../../.nuget/packages/mongodb.driver/2.11.0/lib/net452/MongoDB.Driver.dll"
let connection = MongoDB.Driver.MongoClient "someConnectionString"
however, when executed, there's still a problem loading the DnsClient assembly, as in the error message below:
System.TypeInitializationException: The type initializer for 'MongoDB.Driver.Core.Misc.DnsClientWrapper' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'DnsClient, Version=1.3.1.0, Culture=neutral, PublicKeyToken=4574bb5573c51424'. The system cannot find the file specified.
File name: 'DnsClient, Version=1.3.1.0, Culture=neutral, PublicKeyToken=4574bb5573c51424'
at MongoDB.Driver.Core.Misc.DnsClientWrapper..ctor()
at MongoDB.Driver.Core.Misc.DnsClientWrapper..cctor()
--- End of inner exception stack trace ---
at MongoDB.Driver.Core.Misc.DnsClientWrapper.get_Instance()
at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString)
at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
at MongoDB.Driver.MongoUrlBuilder..ctor(String url)
at MongoDB.Driver.MongoUrl..ctor(String url)
at MongoDB.Driver.MongoClientSettings.FromConnectionString(String connectionString)
at MongoDB.Driver.MongoClient..ctor(String connectionString)
at <StartupCode$FSI_0181>.$FSI_0181.main#()
Stopped due to error
How to make the MongoDB.Driver.Core refer to the right path for DnsClient?
Try restore/install all your drivers(mongoDB.Driver.Core and ones depending on),
I got the same error with the following situation :
I have a DAL class library with dependency packages AspNetCore.Identity.MongoDBCore(2.1.1) and MongoDB.Driver.Core(2.11.0), An API project which lacked the Identity.MongoDBCore(2.1.1) but had the MongoDB.Driver.Core(2.11.0),
The Dependency container thrawed the DNSClient exception,{"The type initializer for 'MongoDB.Driver.Core.Misc.DnsClientWrapper' threw an exception."}

Service running on one server but not on another ~ The type name or alias xxx could not be resolved

I have an issue with a service. I am installing the service via an Advanced Installer installation file, and after installing it, it runs just fine on the development server.
However, when trying to install the service using the same installation file on a different server, the service crashes during startup with the following error message:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolverImpl.ResolveType(System.String, Boolean)
at Microsoft.Practices.Unity.Configuration.RegisterElement.GetRegisteringType()
at Microsoft.Practices.Unity.Configuration.RegisterElement.ConfigureContainer(Microsoft.Practices.Unity.IUnityContainer)
at Microsoft.Practices.Unity.Configuration.ContainerElement+<>c__DisplayClass1.<ConfigureContainer>b__0(Microsoft.Practices.Unity.Configuration.ContainerConfiguringElement)
at Microsoft.Practices.ObjectBuilder2.EnumerableExtensions.ForEach[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>, System.Action`1<System.__Canon>)
at Microsoft.Practices.Unity.Configuration.ContainerElement.ConfigureContainer(Microsoft.Practices.Unity.IUnityContainer)
at Microsoft.Practices.Unity.Configuration.UnityConfigurationSection.Configure(Microsoft.Practices.Unity.IUnityContainer, System.String)
at Microsoft.Practices.Unity.Configuration.UnityContainerExtensions.LoadConfiguration(Microsoft.Practices.Unity.IUnityContainer, Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, System.String)
at Microsoft.Practices.Unity.Configuration.UnityContainerExtensions.LoadConfiguration(Microsoft.Practices.Unity.IUnityContainer, Microsoft.Practices.Unity.Configuration.UnityConfigurationSection)
at NFCommonImplementation.Factory.NfUnityContainer..ctor()
at NFCommonImplementation.Factory.NfUnityContainer.get_Instance()
at NFObjectFactory.CommonObjectFactory..ctor()
at NFObjectFactory.CommonObjectFactory.<.cctor>b__0()
at System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateValue()
at System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].LazyInitValue()
at System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Value()
at NFDataImporter.ImportService.<Start>b__2()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
Using the console to manually start the service file (which uses topshelf), specifies the error as follows:
Topshelf.Hosts.ConsoleRunHost Critical: 0 : The service threw an unhandled exception, System.InvalidOperationException: The type name or alias INetReportDao could not be resolved. Please check your configuration file and verify this type name.
I've already checked the unity configuration file, which reads:
[...]
<typeAlias alias="INetReportDao"
type="NFCommonInterfaces.Database.DAO.INetReportDao, NFCommonInterfaces, Version=6.0.0.1, Culture=neutral, PublicKeyToken=c98e951d4a9d1d0a" />
[...]
<typeAlias alias="NetReportDao"
type="NFCommonImplementation.Database.DAO.NetReportDao, NFCommonImplementation, Version=6.0.0.1, Culture=neutral, PublicKeyToken=c98e951d4a9d1d0a" />
[...]
<register type="INetReportDao" mapTo="NetReportDao">
</register>
[...]
I've also checked that the NFCommonImplementation.dll and NFCommonInterfaces.dll are located right next to the service executable.
Now I'm at my wit's end. Theoretically, it should work since the installer installs the exact same version of the service on both servers. However, for some reason it works on one server, and not on another.
Could it be that I'm missing dependencies? The installer already automatically recognizes a dependency on Visual C++ Redistributable for Visual Studio 2012 and installs it. Could there be other dependencies required for this that might be installed on the development server and not the test server which could cause this problem?
Okay, after some investigation, I figured out how to fix the issue, and after some more investigation, I found out what had caused it:
The Fix:
The missing .dlls have to be installed into the GAC. The easiest way to do so is using the followinh PowerShell script:
Set-location "[dll file location]"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("[dll file name]")
The Cause:
On the development server, the build process installed the .dlls in question into a custom assembly cache which the service was able to access if run on that server. However, it naturally was not able to find those files on any other server.
I hope this helps others who are experiencing similar difficulties.

Google.Apis.Http.ConfigurableMessageHandler exception at runtime

I have problem with Google Analytics API .NET.
While connecting to GA via api at line
var certificate = new X509Certificate2(pathToPrivateKey, passToPrivateKey, X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(serviceAccountEmailAddress)
{
Scopes = scopes
}.FromCertificate(certificate));
It give below error
Message=The type initializer for 'Google.Apis.Http.ConfigurableMessageHandler' threw an exception.
Source=Google.Apis.Core
TypeName=Google.Apis.Http.ConfigurableMessageHandler
StackTrace:
at Google.Apis.Http.ConfigurableMessageHandler..ctor(HttpMessageHandler httpMessageHandler)
at Google.Apis.Http.HttpClientFactory.CreateHttpClient(CreateHttpClientArgs args) in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis.Core\Apis\Http\HttpClientFactory.cs:line 37
at Google.Apis.Auth.OAuth2.ServiceAccountCredential..ctor(Initializer initializer) in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis.Auth.DotNet4\OAuth2\ServiceAccountCredential.cs:line 217
at ConsoleApplication3.Program.AuthenticationGA(String pathToPrivateKey, String serviceAccountEmailAddress, String passToPrivateKey) in C:\Documents and Settings\pivotaladmin.WA-PIV\my documents\visual studio 2010\Projects\ConsoleApplication3\ConsoleApplication3\Program.cs:line 30
at ConsoleApplication3.Program.Main(String[] args) in C:\Documents and Settings\pivotaladmin.WA-PIV\my documents\visual studio 2010\Projects\ConsoleApplication3\ConsoleApplication3\Program.cs:line 69
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.FileLoadException
Message=Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Source=Google.Apis.Core
FileName=System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes
FusionLog==== Pre-bind state information ===
Project type: Console app
.NET Framework 4.0
MS Visual Studio 2010 Express
Windows Server 2003
I tried the same code on Windows 7 and it works.
I have no idea what goes wrong.
Any idea?
It looks like your main problem is the inner exception you got:
InnerException: System.IO.FileLoadException
Message=Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies.
The good news is that you should just install the following patch: KB2468871, as suggested here:
Could not load file or assembly System, Version=2.0.5.0 in .NET 4 MVC 4 application

NUnit.ConsoleRunner.Runner "System.Security.SecurityException: That assembly does not allow partially trusted callers"

nunit-console.exe throws the following error while i tried to execute from Mapped Network Drive
Unhandled Exception: System.TypeInitializationException: The type initializer for 'NUnit.ConsoleRunner.Runner' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
at NUnit.ConsoleRunner.Runner..cctor()
The action that failed was:
LinkDemand
The assembly or AppDomain that failed was:
nunit-console-runner, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77
The method that caused the failure was:
NUnit.Core.Logger GetLogger(System.Type)
The Zone of the assembly that failed was:
Internet
The Url of the assembly that failed was:
file:///Z:/jenkinsworkspace/workspace/FlashUpload/tools/NUnit/lib/nunit-console-runner.DLL
--- End of inner exception stack trace ---
at NUnit.ConsoleRunner.Runner.Main(String[] args)
at NUnit.ConsoleRunner.Class1.Main(String[] args)**
I tried adding loadFromRemoteSources enabled="true" in nunit-console.exe.config, but that did not solve the problem.
Add this to the nunit-console.config file.
<supportedRuntime version="v4.0"/>
Got this from here:
Get .NET to consider a specific network share to be fully trusted: