Stores and C# assembly dll files not being loaded - c#

I have recently tried adding In App Purchase into my Unity project. Unfortunately, it didn't show in the Components drop down menu. I could use the option to create IAP Button and perform code-less IAP configuration but it wasn't there in the menu. So I decided to configure IAP through script. But the script too throws some errors. The error goes like this:
"Assembly 'Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll' will not be loaded due to errors: Reference has errors 'Stores'."
Four errors just like the above one shows up for Assembly-CSharp.dll, Editor.dll and Assembly-CSharp-firstpass.dll
And then this one:
"Assembly 'Assets/Plugins/UnityPurchasing/Bin/Stores.dll' will not be loaded due to errors:
Unable to resolve reference 'UnityEngine.UI'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector."
I have tried re-installing In App Purchase package.
I have tried changing the API from .NET Standard 2.0 to .NET 4.x (and did the vice versa and still did not work)
Downgrading unity project isn't really a good idea but anyways I gave it a try but it just added to the already existing errors.
Upgrading to newer Unity version (alpha version) didn't help.
The error occurs whenever I initialize the ConfigurationBuilder referring StandardPurchasingModule.
public void InitializePurchasing()
{
// If we have already connected to Purchasing ...
if (IsInitialized())
{
// ... we are done here.
return;
}
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct(TWO_BOLTS, ProductType.Consumable);
builder.AddProduct(FIVE_BOLTS, ProductType.NonConsumable);
UnityPurchasing.Initialize(this, builder);
}
The worst part is that I am unable to use my scripts after writing the ConfigurationBuilder initialization code. Unity asks me to fix any compiler errors and assign a valid script. I have searched for the answer for so long. I am really stuck in here. Please help.

Your issue seems to be related to verison of Unity you using. You can follow progress of this issue on official Unity issue tracker.
If this issue is showstopper for you than cosider downgrading as you using beta verions of Unity and as official site states:
As with any beta program, you’ll have early access to new features and
will be able to assist in the final steps of their development. That
means you’re likely to experience Unity as less stable than a final
version.

Related

The type initializer for 'Amazon.AWSConfigs' threw an exception

I'm trying to log in using AWS Cognito by running the app after building it in Unity.
I couldn't log in properly, and when I tried debugging, I found the phrase "The type initializer for Amazon.AWSConfigs' thread an exception."
This error occurs when executing the following code:
Amazon.CognitoIdentityProvider.AmazonCognitoIdentityProviderClient provider =
new Amazon.CognitoIdentityProvider.AmazonCognitoIdentityProviderClient(new Amazon.Runtime.AnonymousAWSCredentials(), regionTable[REGION]);
The app itself is built normally, but there seems to be a problem with logging in using AWS.
(I found this error in the PC and oculus environment.)
Some of the answers told me to modify the Config file. But I couldn't find the Config file. The location of this file was also unknown.
I found this answer "https://github.com/aws/aws-sdk-net/issues/310" but I couldn't apply this for me.
I found this Document "https://docs.unity3d.com/kr/2021.1/Manual/upm-config.html#upmconfig" but the Config file didn't exist in this path. My environment is Mac.
additionally,
I use AWS SDK called aws-sdk-net45-3.7.193.0.
UnityInitializer.AttachToGameObject(this.gameObject);
Amazon.AWSConfigs.HttpClient = Amazon.AWSConfigs.HttpClientOption.UnityWebRequest;
In this code, my Project Cannot understand UnityInitializer, HttpClient, and HttpClientOption.
What else changes are needed in order to mitigate the above issue.
I solved this problem.
The problem was that I was using IL2CPP as Script backend.
Simply using Script backend as Mono is one way. But my project had to use IL2CPP.
In order to use IL2CPP and use the Unity project using AWS Cognito, it is recommended that you:
Use .NetStandard2.0.
Use AWS SDK that is compatible with .NetStandard 2.0.
I used Unity 2020.3.19f version to use .NetStandard 2.0.
If you are using a URP project and there is an error in URP due to downgrade of Unity version, it is recommended that you act as follows.
Enter the Package folder for that project
Open Manifest.json and Package-lock.json files
Change the Render Pipeline version to 10.8.1 (for 2020.3.19f1 version. I didn't experiment with other versions.)
Reference found to resolve this issue.
https://forum.unity.com/threads/issue-with-system-configuration-configurationmanager-get_appsettings-on-ios.1026877/#post-6656764
https://docs.aws.amazon.com/ko_kr/mobile/sdkforunity/developerguide/aws-unity-sdk.pdf
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal#10.8/manual/index.html

Is calling System.Diagnostics.Process.Start() truly problematic?

In the Validation Result that I get when readying my app for submission to the Microsoft Store (which my app "PASSED WITH WARNINGS"), I got this "Fail" under the "Package Sanity Test" section:
The code which contains such a call is:
private void myMapsHelpToolStripMenuItem_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://ramblingnotesofageezer.substack.com/p/map-o-matic-overview");
}
I am using that code due to the recommendation to do so here. How do I start a process from C#?
Is this truly a problem? If so, what should I use instead of the call to System.Diagnostics.Process.Start()?
I find it odd that it is classified as a failed part of the test, yet the overall results are that my app passed (albeit with warnings).
UPDATE
I checked out the link in the comment from Codexer, where it says, "Starting a utility can often provide a convenient way to obtain information from the operating system, access the registry, or access system capabilities. However, you can use UWP APIs to accomplish these sorts of tasks instead."
If this is the solution, do the UWP APIs have an equivalent to System.Diagnostics.Process.Start()?
UPDATE 2
I followed the steps in the answer, but the solution still doesn't compile, due to an error with this line of code:
await Windows.System.Launcher.LaunchUriAsync(uri);
In fact, even when I comment out the offending line, the project will no longer compile, but doesn't give me any information about how to solve the problem, just this:
I set the Package Management Format to PackageReference, and installed version 10.0.18362.2005 of Microsoft.Windows.SDK.Contracts, but it is complaining about needing a package reference...?!? I tried adding using Windows.System;
and using Microsoft.Windows.SDK.Contracts; but neither is recognized.
The package is installed for the project, as you can see here:
UPDATE 3
Regarding the "Must Use Package Reference" err msg, I have three questions revolving around what I see here:
The verbiage below Microsoft.Windows.SDK.Contracts says I can update versions of this package - should I?
I do not see a Reference to Microsoft.Windows.SDK.Contracts in my project's References, although it has been installed. Do I need to add one - if so, from where?
The context menu on my References affords me the ability to "Migrate packages.config to PackageReference..." should I do that?
If you were developing an uwp application, for opening open a web uri, it is recommended to use Launcher.LaunchUriAsync(Uri) method instead, this method starts the default browser to open the specified URI.
For example:
private async void button_Click(object sender, RoutedEventArgs e)
{
Uri uri = new Uri("http://www.google.com");
await Windows.System.Launcher.LaunchUriAsync(uri);
}
Update:
As Codexer mentioned, you could refer to this document to use uwp api in winform app.
I have created a winform project, its target framework is .Net Framework4.8. For earlier versions of .NET(.NET Core 3.x, .NET 5 Preview 7 (or earlier), or .NET Framework), you could refer to my steps.
1.Click Tools->NuGet Package Manager-> Package Manager Settings-> Change Default package management format to PackageReference. As follows:
2.Install the Microsoft.Windows.SDK.Contracts package, note that you need to install the appropriate version. Please check the corresponding version below. (Installation details: Right click Reference-> Manage NuGet Packages->Browse->Search Microsoft.Windows.SDK.Contracts->install)
10.0.19041.xxxx: Choose this for Windows 10, version 2004, version 20H2
10.0.18362.xxxx: Choose this for Windows 10, version 1903.
10.0.17763.xxxx: Choose this for Windows 10, version 1809.
10.0.17134.xxxx: Choose this for Windows 10, version 1803.
3.Run the project

Unable to find an entry point named 'sk_color_get_bit_shift' in DLL 'libSkiaSharp'. when using SkiaSharp 15.9.1

I am attempting to build and use the MicoCharts project available here: https://github.com/dotnet-ad/Microcharts which is dependant on this SkiaSharp project available here: https://github.com/mono/SkiaSharp
The specific version I am attempting to use is 15.9.1 (the version that the nuget package downloads) which utilizes skia m59.
I need to build them myself and cannot use Nuget due to business restrictions, just use the package isn't an option for me.
I have built skia m59, SkiaSharp and MicroCharts but when I attempt to create a SKBitmap object I get an error when it attempts to initialize SkiaSharp.SKImageInfo. The error is as follows:
Unable to find an entry point named 'sk_color_get_bit_shift' in DLL 'libSkiaSharp'.
I had to make a few changes to the base BUILD.gn to point to the correct file locations, for the windows SDK and the VC install. I enabled skia_use_gdi in the BUILD.gn and ran the following commands.
python2 tools/git-sync-deps
gn gen out/Release --args="is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_icu=false is_component_build=true"
ninja -C out/Release skia
This process outputs a DLL I assumed is the same as the libSkiaSharp that the SkiaSharp project relies on. I add all my references and run, the project runs successfully until I attempt to create the SkBitmap object then it fails.
Either this DLL is not the correct DLL and I am misunderstanding something here or something in my process is wrong. I would love any help I can get as I am completely new to building these sorts of projects, I am a C# developer by trade.
This is not the same thing. SkiaSharp has a few other bits that it adds to the core skia. The output that you would have got is a skia.dll, which only part. Not sure how you got a libSkiaSharp from the skia target...
If you can't use SkiaSharp from NuGet.org (which is the supported case) you can follow this to build your own: https://github.com/mono/SkiaSharp/wiki/Building-SkiaSharp
You can also check out the Azure DevOps yaml: https://github.com/mono/SkiaSharp/blob/master/scripts/azure-pipelines.yml
Just set up your own DevOps job to use that and all the work will be done for you.

C# , Xamarin.Essentials Secure Storage

After reviewing my options regarding saving JWT token, I chose Xamarin.Essentials Secure Storage.
Problem being that my app always breaks when trying to save a token within the storage with the following error:
"System.AggregateException has been thrown"
The details are as follow:
"Xamarin.Essentials.NotImplementedInReferenceAssemblyException
This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation."
This clearly means that something went wrong in the installaion of the nuget package, so I:
Uninstalled and reinstalled the xamarin.essentials package.
Upgraded .Netstandard to 2.0, thinking that 1.6 wasn't compatible.
Checked if the package is referenced within the csproj file.
So forth, nothing.
For now, I have a TokenStorageController with the following lines of codes :
public bool SaveToken(string token)
{
if(token != null)
{
Preferences.Set(key, token);
if(Preferences.ContainsKey(key))
{
return true;
}
}
return false;
}
The RestService class from where the controller gets called looks like this :
//await SecureStorage.SetAsync("oauth_token", "booommmmmm"); // changed to this simply to check if my controller was the problem
TokenStorageController tokenStorage = new TokenStorageController();
await tokenStorage.SaveToken("boommmmm"); // where I get an error
And here is the exact line where the error occurs:
var loginTask = Task.Run(() => restService.LoginAsync(user)).Result;
If no solutions, I will remove all packages and reinstall them all. ONE BY ONE! I swear I'll do it!
And if no solutions at all, I will store the token within SQL as I already have a controller in place to do so.
I am a Xamarin and C# noob so bear with me please.
FYI: I am using a macOS client for testing purposes, as the cause could be that SecureStorage doesn't work for macOS apps.
Thanks!
Xamarin.Mac is not currently a supported platform, just iOS, Android, UWP.
The code is available for review at:
https://github.com/xamarin/Essentials/tree/master/Xamarin.Essentials/SecureStorage

MonoTouch - running mdtool from Jenkins

I downloaded the latest MonoTouch (4.0.4.1 and MonoDevelop 2.6 beta) to fix some issues we were having.
I was hoping that my build in Jenkins (using mdtool) would start working, but no luck.
mdtool gives this error (shortened):
2011-07-28 08:18:47.399 mdtool[14484:60f] *** __NSAutoreleaseNoPool(): Object 0x492260 of class NSCFString autoreleased with no pool in place - just leaking
2011-07-28 08:18:47.401 mdtool[14484:60f] +[NSDictionary dictionaryWithContentsOfFile:]: unrecognized selector sent to class 0xa0bdd3ec
2011-07-28 08:18:47.401 mdtool[14484:60f] *** __NSAutoreleaseNoPool(): Object 0x3f02540 of class NSCFString autoreleased with no pool in place - just leaking
In the past this was related to code generation with the designer.
Is this a known issue being working on by Xamarin? (I can open a bugzilla bug if needed)
PS: one thing else to mention, is we have deleted the designer.cs files for several of our views. (This was a crude way to disable code generation at the time, we needed to manually setup our outlets, exports, etc.)
EDIT: posted to bugzilla here.
You are not using the stable version of MonoDevelop, you are using an outdated preview, that was fixed in later betas.

Categories