51degrees / device-detection-dotnet Goto Github PK
View Code? Open in Web Editor NEWDevice detection services for 51Degrees Pipeline
License: Other
Device detection services for 51Degrees Pipeline
License: Other
Documentation on the automatic data file updates feature mentions that there are 3 properties that control the behavior:
DataUpdateUrl
DataUpdateVerifyMd5
DataUpdateUseUrlFormatter
These properties are exposed via the json configuration, but are not exposed on the DeviceDetectionOnPremisePipelineBuilder
51degreesHashV41-Lite.hash.gz
to verify the vehaviors.Hi, me again! We updated to version 4.4.23
to use the navigator values and UachJsConversionElementBuilder
, but even with RUN apt install libatomic1
we are getting this again:
System.Exception: Failed to load the Device Detection native library, common causes include:
- Missing dependencies:
o On Windows, the Visual C++ runtime is not installed, see the Visual Studio download page for the latest C++ Redistributable: https://visualstudio.microsoft.com/downloads/
o On Linux, the libatomic shared object is missing. On Debian based distributions, run ‘apt install libatomic1’; on RedHat based distributions, run ‘<yum|dnf> install libatomic’.
- The DLL file was not copied to the output directory during build, refer to the ‘System.DllNotFoundException’ inner exception for the exact library file name.
- The incorrect DLL was copied to the output directory, this maybe be caused by the build chain determining the incorrect platform or the incorrect platform has been specified in the build process. If using the dotnet command, see https://docs.microsoft.com/en-us/dotnet/core/rid-catalog to specify the correct runtime. If using Visual Studio, make sure the selected Platform (x86/x64) matches your environment.
- If building for .NET Framework, the AnyCPU configuration is not supported, make sure to build for the required Platform (x86/x64).
---> System.TypeInitializationException: The type initializer for 'FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE' threw an exception.
---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libFiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll: cannot open shared object file: No such file or directory
at void FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_DeviceDetectionHashEngineModule(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at static FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE+SWIGExceptionHelper()
--- End of inner exception stack trace ---
at new FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE+SWIGExceptionHelper()
at static FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE()
--- End of inner exception stack trace ---
at IntPtr FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.new_ConfigHashSwig()
at new FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.ConfigHashSwig()
at IConfigSwigWrapper FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory+<>c.<.ctor>b__4_7(?)+() => { }
at T FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory.DllExceptionHandler<T>(Func<T> action)
--- End of inner exception stack trace ---
at T FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory.DllExceptionHandler<T>(Func<T> action)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory()+() => { } [3]
at IConfigSwigWrapper FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory.CreateConfig()
at IConfigSwigWrapper FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngineBuilder.get_SwigConfig()
at DeviceDetectionHashEngineBuilder FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngineBuilder.SetPerformanceProfile(PerformanceProfiles profile)
at TEngine FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.ConfigureAndBuild<TBuilder, TEngine>(OnPremiseDeviceDetectionEngineBuilderBase<TBuilder, TEngine> builder)
at IPipeline FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.Build()
Can you help me figure out what to do here?
Running .NET Framework 4.8 in IIS from onprem file 51Degrees-LiteV4.1.hash and getting the following error:
"Too many file handles have been created during initialisation."
Code:
using (var pipeline = new FiftyOne.DeviceDetection.DeviceDetectionPipelineBuilder().UseOnPremise(fileName, null).Build())
{
using (var data = pipeline.CreateFlowData())
{
data.AddEvidence(FiftyOne.Pipeline.Core.Constants.EVIDENCE_QUERY_USERAGENT_KEY, userAgent);
data.Process();
var result = data.Get<FiftyOne.DeviceDetection.IDeviceData>();
var value = result.IsMobile.Value;
return value;
}
}
The error is on the first row (the Build method):
FiftyOne.DeviceDetection.Hash.Engine.OnPremise
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.EngineHashSwig..ctor(String fileName, ConfigHashSwig config, RequiredPropertiesConfigSwig properties)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory.<>c.<.ctor>b__4_0(String fileName, IConfigSwigWrapper config, IRequiredPropertiesConfigSwigWrapper requiredProperties)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory.CreateEngine(String fileName, IConfigSwigWrapper config, IRequiredPropertiesConfigSwigWrapper requiredProperties)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngine.RefreshData(String dataFileIdentifier)
at FiftyOne.Pipeline.Engines.FlowElements.OnPremiseAspectEngineBase2.AddDataFile(IAspectEngineDataFile dataFile) at FiftyOne.DeviceDetection.Shared.FlowElements.OnPremiseDeviceDetectionEngineBase
1.AddDataFile(IAspectEngineDataFile dataFile)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngineBuilder.NewEngine(List1 properties) at FiftyOne.Pipeline.Engines.FlowElements.AspectEngineBuilderBase
2.BuildEngine()
at FiftyOne.Pipeline.Engines.FlowElements.SingleFileAspectEngineBuilderBase2.Build() at FiftyOne.Pipeline.Engines.FlowElements.SingleFileAspectEngineBuilderBase
2.Build(String datafile, Boolean createTempDataCopy)
at FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.ConfigureAndBuild[TBuilder,TEngine](OnPremiseDeviceDetectionEngineBuilderBase`2 builder)
at FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.Build()
One of our clients has reported a high number of errors when calling the cloud service.
The error message returned is : 'waiting for response from the cloud service.'
The issue is seen across genuine user agents as well as crawlers.
The question raised is if this could be due to throttling when the number of requests is high?
See attached error message.
Hello Good Day
I am doing a demo for TAC intelligence service with C#.
But Im getting this error
'Failed to load aspect properties for element 'hardware'. This is because your resource key does not include access to any properties under 'hardware'.
I am trying to use these Resource keys for the demo. I selected the property HardwareVendor and HardwareModel.
AQTJih7vx8Sml9Mi2Ug or AQTJih7v-a4hFtAi2Ug
Do I need a special resource key with privileges??
Im using this code, I get it from 51degrees website
using FiftyOne.DeviceDetection.Cloud.Data;
using FiftyOne.DeviceDetection.Cloud.FlowElements;
using FiftyOne.DeviceDetection.Shared;
using FiftyOne.Pipeline.CloudRequestEngine.FlowElements;
using FiftyOne.Pipeline.Core.FlowElements;
using GettingStarted;
using Microsoft.Extensions.Logging;
using System;
using System.Net.Http;
namespace FiftyOne.DeviceDetection.Examples.Cloud.TacLookup
{
public class Program
{
public class Example
{
private static string TAC = "35925406";
private static string TAC2 = "86386802";
public void Run(string resourceKey, string cloudEndPoint = "")
{
Console.WriteLine("This example shows the details of devices " +
"associated with a given 'Type Allocation Code' or 'TAC'.");
Console.WriteLine("More background information on TACs can be " +
"found through various online sources such as Wikipedia: " +
"https://en.wikipedia.org/wiki/Type_Allocation_Code");
Console.WriteLine("----------------------------------------");
ILoggerFactory loggerFactory = new LoggerFactory();
HttpClient httpClient = new HttpClient();
// Create a cloud request engine builder
var cloudRequestEngineBuilder = new CloudRequestEngineBuilder(loggerFactory, httpClient)
.SetResourceKey(resourceKey);
// If a cloud endpoint has been provided then set the
// cloud pipeline endpoint.
if (string.IsNullOrWhiteSpace(cloudEndPoint) == false)
{
cloudRequestEngineBuilder.SetEndPoint(cloudEndPoint);
}
// Create the cloud request engine
using (var cloudEngine = cloudRequestEngineBuilder.Build())
// Create the property-keyed engine to process the
// response from the request engine.
using (var propertyKeyedEngine = new HardwareProfileCloudEngineBuilder(loggerFactory)
.Build())
// Create the pipeline using the engines.
using (var pipeline = new PipelineBuilder(loggerFactory)
.AddFlowElement(cloudEngine)
.AddFlowElement(propertyKeyedEngine)
.Build())
{
// Pass a TAC into the pipeline and list the matching devices.
AnalyseTac(TAC, pipeline);
AnalyseTac(TAC2, pipeline);
}
}
static void AnalyseTac(string tac, IPipeline pipeline)
{
// Create the FlowData instance.
using (var data = pipeline.CreateFlowData())
{
// Add the TAC as evidence.
data.AddEvidence(Constants.EVIDENCE_QUERY_TAC_KEY, tac);
// Process the supplied evidence.
data.Process();
// Get result data from the flow data.
var result = data.Get();
Console.WriteLine($"Which devices are associated with the TAC '{tac}'?");
foreach (var device in result.Profiles)
{
var vendor = device.HardwareVendor;
var name = device.HardwareName;
var model = device.HardwareModel;
// Check that the properties have values.
if (vendor.HasValue &&
model.HasValue &&
name.HasValue)
{
Console.WriteLine($"\t{vendor.Value} {string.Join(",", name.Value)} ({model.Value})");
}
else
{
Console.WriteLine(vendor.NoValueMessage);
}
}
}
}
}
static void Main(string[] args)
{
// Obtain a resource key for free at https://configure.51degrees.com
// Make sure to include the 'HardwareVendor' and 'HardwareModel'
// properties as they are used by this example.
//string resourceKey = "AQTJih7v-a4hFtAi2Ug";
string resourceKey = "AQTJih7vx8Sml9Mi2Ug";
if (resourceKey.StartsWith("!!"))
{
Console.WriteLine("You need to create a resource key at " +
"https://configure.51degrees.com and paste it into the code, " +
"replacing !!YOUR_RESOURCE_KEY!!.");
Console.WriteLine("Make sure to include the 'HardwareVendor', " +
"'HardwareName' and 'HardwareModel' properties as they " +
"are used by this example.");
}
else
{
new Example().Run(resourceKey);
}
Console.WriteLine("Done. Press any key to exit.");
Console.ReadKey();
}
}
}
https://51degrees.com/documentation/4.2/_info__resourcekeys.html
When using server-side Apple detection, it may be desirable to disable JavaScriptBuilderElement
and JsonBuilderElement
.
These elements add a significant performance penalty and are added to the pipeline by default if using the web integration package. However, they're not needed if server-side Apple detection is being used.
In the future, we plan to address this by improving the performance of these elements, adding more configuration options to limit the properties they include, and allow them to be fully disabled if needed.
For the moment, the only way to manage this is with the following workaround:
JavaScriptBuilderElement
and JsonBuilderElement
:{
"Elements": [
{
"BuilderName": "AppleProfileEngineBuilder",
"BuildParameters": {
...
}
},
{
"BuilderName": "DeviceDetectionHashEngineBuilder",
"BuildParameters": {
...
}
},
{
"BuilderName": "SetHeadersElementBuilder"
},
{
"BuilderName": "StopElementBuilder"
},
{
"BuilderName": "JsonBuilderElementBuilder"
},
{
"BuilderName": "JavaScriptBuilderElementBuilder",
"BuildParameters": {
...
}
}
]
}
Hi,
I've been facing performance issues with the NuGet package. The response time takes on average over 600ms and sometimes it has even gone to more than a second.
One of the reasons could be because the CloudRequestEngineBuilder function takes HttpClient as one of the inputs. From what I understand, HttpClient has some performance issues. You can check this Reddit Discussion
It would be great if the function can take other providers like RestSharp or WebRequest so consumers can use whichever providers they like.
Attached below screenshots of my tests and the code I used.
Appreciate your help on this.
When downloading a data file from the 51Degrees distributor (https://distributor.51degrees.com/api/v2/download?LicenseKeys=[LicenseKey]&Type=[Type]&Download=True&Product=[Product]) if the first request times out, the second request then returns a 429 (too many requests).
The first request should not be logged as a successful download if it times out, and the second request should return successfully.
I have attached a sample project that crashes with "AccessViolationException: Attempting to read or write protected memory".
Please see the attached project for the test case to reproduce the issue. Please note that there are two constants that need to be set the at top of file "DeviceInfoDetection" before this sample can be run (the path to "Enterprise-HashV41.hash" and the License Key).
I was not sure where to file this issue since my test case is written in C#, bu the actual issue is likely in underlying C code. Apologies if I am at the wrong place.
A client is facing an issue where they are unable to establish a secure connection to 51Degrees library's HTTPS endpoint from our code.
The update code which is executed looks like:
using (var pipeline = new FiftyOne.DeviceDetection.DeviceDetectionPipelineBuilder(loggerFactory)
.UseOnPremise(_hashFile, _licenseKey, false)
.SetDataFileSystemWatcher(true)
.SetShareUsage(false)
.SetAutoUpdate(true)
.SetDataUpdateOnStartUp(true)
.SetUpdatePollingInterval(_pollingIntervalMinutes * 60)
.SetUpdateRandomisationMax(_updateRandomisationMaxMinutes * 60)
.Build())
{
// Hash file successfully updated
}
The error occurs when the file is already updated - updating an older file is working correctly.
The error message:
Error accessing data update service at 'https://distributor.51degrees.com/api/v2/download?LicenseKeys=&Download=True&Type=HashV41' for engine 'DeviceDetectionHashEngine'
The error message status:
FiftyOne.Pipeline.Engines.Services.AutoUpdateStatus.AUTO_UPDATE_HTTPS_ERR
They have checked their network settings to ensure that there are no restrictions or firewalls blocking the HTTPS connection and also tested their code against other HTTPS endpoints successfully, confirming that the issue seems specific to the connection with the 51Degrees library.
Development Environment Details:
Programming Language: C# libary .netstandard2.0
Operating System: Windows
Version of the 51Degrees software library:
FiftyOne.DeviceDetection:4.4.23
FiftyOne.DeviceDetection.Hash.Engine.OnPremise:4.4.23
Please add "Project URL" pointing to a Github project repository into each of your NET libraries.
It will help everyone to quickly go to the project source and learn the change history.
Hello,
We've found out that the Javascript API exposes a call that will return low- and high entropy user agent client hints without needing Accept-CH
and Permission-Policy
headers. However, the key names and formatting of the values is a bit different than what we receive through response headers. I receive the following from Google Chrome with the navigator.userAgentData.getHighEntropyValues
call:
Whereas response headers present data like this:
Notice the difference in key names, formatting of brands where the JS API uses newline separators and the response headers a ";", the usage of quotes etc.
How should we provide the evidence we receive from the JS API? Should we convert it to the response header naming and formatting, or use different prefixes when adding it to the flowdata?
Looking forward to your response.
Best regards,
Martijn
Hi, I am attempting to use FiftyOne.DeviceDetection
version 4.4.16
in AWS Lambda, which is running .NET 6 (identifier dotnet6
) which uses an OS called Amazon Linux 2. I do not believe it is possible to run apt install libatomic1
in the Lambda as it's a ZIP deployment, however I have not tried a Docker deployment (a related app running in Docker works after running apt install libatomic1
). In this environment, I get the dreaded:
System.DllNotFoundException: Unable to load shared library 'FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libFiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll: cannot open shared object file: No such file or directory
Could you suggest me ideas on how to proceed here?
I've discovered another possible issue.
When I publish from visual Studio the following dll gets copied to the webroot (same level as the web.config) as well as to the bin folder:
FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll
Obviously it should be copied just to the bin folder. I wonder if you could fix this behaviour.
Thanks
valgen
Originally posted by @valgen in #13 (comment)
I get a 404 page when I try to get the data file listed in the documentation. The link is https://github.com/51Degrees/device-detection-data. It is on https://docs.51degrees.com/documentation/4.1/_examples__device_detection__configure_from_file__on_premise_hash.html in the documentation
Hi all,
I am migrating from ASP.Net MVC 5 to Asp.Net Core 6 and I made an empty project just to test device detection because we use it a lot and I have a couple of issues.
First of them is this code in Program.cs
builder.Services.AddSingleton<DeviceDetectionHashEngineBuilder>(); builder.Services.AddFiftyOne(builder.Configuration);
After adding the last line, Hot reload feature stops working and I can not see any UI changes (.cshtml file) without rebuilding the application or restarting it.
Also on every page load I see this error in console
fail: FiftyOne.Pipeline.Core.FlowElements.Pipeline[0]
Could not find property 'Promise'.
fail: FiftyOne.Pipeline.Core.FlowElements.Pipeline[0]
Could not find property 'Fetch'.
I followed this example https://51degrees.com/device-detection-dotnet/4.3/_asp_net_core3_81_2_startup_8cs-example.html
What might be the problem ?
I've noticed some information in the client hints seems to be ignored. When I provide the browser version with the client hint sec-ch-ua-full-version
, for example 97.0.4692.99
I can only retrieve 97
from the DeviceData. What happens to the minor version?
What's more is that I can provide information about the bitness or architecture with the client hints sec-ch-ua-bitness: 64
and sec-ch-ua-arch: x86
which I'm not seeing back in any way in the device data. I'd expect some assumptions can be made about the hardware or device with this information.
Where can I find a dot-net library (not dot-net Core) example that sets Request.Browser["IsMobile"] for an asp.net IIS web site project?
The upgrade instruction on the 51 degrees website contains code for Global.asax.cs that I cannot get to compile. The errors are:
We are upgrading from version 3.x for an asp.net web site project (not a web application project). I followed the directions at: https://51degrees.com/documentation/4.4/_device_detection__migration_guides_51_degrees_v3.html
While there are Linux packages for FiftyOne.DeviceDetection builds, .NET is not tested against a Linux platform as per the supported versions in the documentation.
Hi,
I need to mention this issue which was closed sometimes ago: #13 (comment)
In the above issue I was forced to set my project Active Platform to "x64" to work properly.
With version 4.4.12 you have introduced a change where the Native DLLs are copied to the runtimes directory, not the root of the bin directory, and the default for AnyCPU is x64 instead of x86.
Unfortunately this change has broken my project and I started receiving "Failed to load the Device Detection native library" errors at runtime.
To fix this issue I had to set my project Active Platform to "Any CPU".
Unfortunately it only works in debug mode.
When I publish and release, the native dll doesn't get copied to the root of the bin directory anymore.
Only the runtimes directory gets created and it gets ignored at runtime, causing the error mentioned before.
FYI my project is built with .NET Framework 4.8 (not .NET Core).
Right now libFiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll
depends on glibc
2.27. Unfortunately, CentOS 7 supports only glibc
2.17. Would it be possible to compile device detection library with an older glibc
?
$ ldd runtimes/linux-x64/native/libFiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll
runtimes/linux-x64/native/libFiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by runtimes/linux-x64/native/libFiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.dll)
linux-vdso.so.1 => (0x00007ffea0f2e000)
libatomic.so.1 => /lib64/libatomic.so.1 (0x00007f2745131000)
libm.so.6 => /lib64/libm.so.6 (0x00007f2744e2f000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2744c13000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2744845000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2745720000)
To reproduce:
Supported I/O
property.When creating the pipeline, the program will crash with the following error:
FiftyOne.Pipeline.Core.Exceptions.PipelineException: Unable to determine the type associated with this property. No c# property found matching definition DeviceDataCloud.SupportedI/O and json type 'Array' is not mapped.
This is because the cloud service property meta-data (accessible at https://cloud.51degrees.com/api/v4/accessibleproperties?resource=[RESOURCE_KEY]) only gives the json 'type' of each property.
For strongly-typed languages, we need to translate this into the real type. This is generally simple, but presents a problem for properties like Supported I/O
where the json type is Array
.
For .NET, we need to translate this into IAsectPropertyValue<IReadOnlyList<string>>
. Rather than making any assumptions, we use the name of the property from the meta-data and reflection in order to get the type from the associated strongly-typed property.
In this case, that doesn't work because the name in the meta-data - SupportedI/O
does not match the name of the property in code SupportedIO
.
This will be fixed in a future release.
If you experience this problem in the meantime, then please let us know by commenting below.
The error message is echoing the parameter value that was in the wrong format:
. This apparently is there for the engineer convenience.This will appear on a page that will never be visible to the user and will be consumed by javascript and at most the results can be made visible through debug logging.
However it may not be desirable as it causes some security scanners to false-alarm and mis-report the vulnerability. The POST body may deliberately contain the URL-encoded HTML piece, that will be url-decoded and quoted in the response. It will then be detected by the scanner and make the alarm go off.
Let's remove quoting the wrong value of the parameter in the response - that will not let the HTML injection to happen. Even though on the invisible page it does not do any harm.
When using the Strong Name Key signing the following error messages about the NuGet pulled files not being Strong Named are seen:
(0): error CS1577: Assembly generation failed -- Referenced assembly 'FiftyOne.Pipeline.CloudRequestEngine' does not have a strong name
(0): error CS1577: Assembly generation failed -- Referenced assembly 'FiftyOne.DeviceDetection.Cloud' does not have a strong name
(0): error CS1577: Assembly generation failed -- Referenced assembly 'FiftyOne.Pipeline.JavaScriptBuilderElement' does not have a strong name
(0): error CS1577: Assembly generation failed -- Referenced assembly 'FiftyOne.Pipeline.JsonBuilder' does not have a strong name
(0): error CS1577: Assembly generation failed -- Referenced assembly 'FiftyOne.Pipeline.Engines.FiftyOne' does not have a strong name
Following on from #13
When solution platform is set to 'AnyCPU', the device detection NuGet package will attempt to load the 32-bit native dll for device detection. If a 64-bit process is being used then this will cause an error similar to the following:
The type initializer for 'FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE' threw an exception.
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.new_ConfigHashSwig()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.ConfigHashSwig..ctor()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory.<>c.<.ctor>b__4_3()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngineBuilder.get_SwigConfig()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngineBuilder.SetPerformanceProfile(PerformanceProfiles profile)
at FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.ConfigureAndBuild[TBuilder,TEngine](OnPremiseDeviceDetectionEngineBuilderBase`2 builder)
at FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.Build()
at project1.Models.FiftyOneDegrees.GetDevice() in C:\Users\user1\source\Workspaces\workspace\project1\project1\Models\FiftyOneDegrees.cs:line 151
The type initializer for 'SWIGExceptionHelper' threw an exception.
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.SWIGExceptionHelper..ctor()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE..cctor()
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_DeviceDetectionHashEngineModule(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.SWIGExceptionHelper..cctor()
This only affects users that build directly from the solution file.
This is unlikely in practice as most people will just use the NuGet packages.
The problem is that the native DLLs are not produced in an AnyCPU flavour. Consequently, the build fails with a message like:
Could not copy the file "D:\Workspace\Pipeline\pipeline-dotnet\FiftyOne.DeviceDetection\FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native\AnyCPU\Debug\FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Native.pdb" because it was not found.
This can be resolved by removing the AnyCPU configuration from the solution file.
Any chance we could get avif support data?
When calling /info to retrieve the product information it sometimes happens that the hash field is empty. Admittedly this only happens intermittently during our automated builds.
This issue may be related to #7 .
Hello, i try to run the Example project DeviceDetectionWebDemo NetCore 3.1
App crash on razor view and throw exception.
How to fix this please?
.NET 6 is the next LTS version of .NET
We need to modify our CI scripts to run the existing tests against this new version and address any issues.
Hi,
I would like to use this library in a WEB application with .NET framework 4.8 and Visual Studio 2017. Is it possible?
Unfortunately I get an exception when I try to execute this code:
new DeviceDetectionPipelineBuilder().UseOnPremise(HostingEnvironment.MapPath("~/App_Data/51Degrees-LiteV4.1.hash"), null, false).SetPerformanceProfile(PerformanceProfiles.LowMemory).Build()
This is the exception (including the inner exceptions):
The type initializer for 'FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE' threw an exception.
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.new_ConfigHashSwig()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.ConfigHashSwig..ctor()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Wrappers.SwigFactory.<>c.<.ctor>b__4_3()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngineBuilder.get_SwigConfig()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.FlowElements.DeviceDetectionHashEngineBuilder.SetPerformanceProfile(PerformanceProfiles profile)
at FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.ConfigureAndBuild[TBuilder,TEngine](OnPremiseDeviceDetectionEngineBuilderBase`2 builder)
at FiftyOne.DeviceDetection.DeviceDetectionOnPremisePipelineBuilder.Build()
at project1.Models.FiftyOneDegrees.GetDevice() in C:\Users\user1\source\Workspaces\workspace\project1\project1\Models\FiftyOneDegrees.cs:line 151
The type initializer for 'SWIGExceptionHelper' threw an exception.
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.SWIGExceptionHelper..ctor()
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE..cctor()
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_DeviceDetectionHashEngineModule(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at FiftyOne.DeviceDetection.Hash.Engine.OnPremise.Interop.DeviceDetectionHashEngineModulePINVOKE.SWIGExceptionHelper..cctor()
Thanks
valgen
Nevermind, found different solution.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.