io.konik.PdfHandler constructor error - c#

I have a c# dotnet 4 solution with one main wpf project which
refer as project a class library with references the local IKVM.*.dll version Version=8.0.5449.1 and ZUGFeRD.NET.dll version 1.0.0.0. When trying to do
PdfHandler handler = new PdfHandler();
I'm getting the next error :
java.util.NoSuchElementException was unhandled
HResult=-2146233088
Message=""
Source=IKVM.OpenJDK.Core
StackTrace:
at java.util.ServiceLoader.LazyIterator.nextService()
at java.util.ServiceLoader.LazyIterator.next()
at java.util.ServiceLoader.1.next()
at io.konik.PdfHandler..ctor() ...
The strange part is that if I use the the IKVM.*.dll and
ZUGFeRD.NET.dll in first project and remove the second project, the example from Github
works. Do you have any ideea? Thank you.

I had the same Problem. This problem could be solved by adding
ikvm.runtime.Startup.addBootClassPathAssembly(typeof(ObjectFactory).Assembly);
before using the ZUGFeRD.NET framework.
I put this code in the constructor of my own ZUGFeRD class.

Related

AppCenter analytics not starting for WPF

I try to use AppCenter for measuring crashes and telemetrics in my application.
The application is a WPF application, using .NET framework 4.7.2.
I register AppCenter the following way:
AppCenter.Start("MY_KEY", typeof(Analytics), typeof(Crashes));
Directly after the registration I see the following output message:
ERROR: Failed to start service 'Analytics'; skipping it.
Microsoft.AppCenter.AppCenterException: Service type does not contain static 'Instance' property of type IAppCenterService. The service is either not an App Center service or it's unsupported on this platform or the SDK is used from a .NET standard library and the nuget was not also added to the UWP/WPF/WinForms project.
vid Microsoft.AppCenter.AppCenter.StartInstance(Type[] services)
I have the following NuGet versions of AppCenter installed:
Microsoft.AppCenter.Analytics: 3.4.2
Microsoft.AppCenter.Crashes: 3.4.2
Has anybody faced the same problem and knows how to solve this?
Thanks in advance.
The issue is located and corrected.
The cause of this issue was caused by a namespace conflict, another package named Analytics.
Refering the correct namespace with full name, resolved this issue:
AppCenter.Start("MY_KEY", typeof(Microsoft.AppCenter.Analytics.Analytics), typeof(Crashes));

Empty project error - Xaml Internal Error error WMC9999: Object reference not set to an instance of an object

I spent more than 10 days searching for a solution which I tried them all.
I have this error message when I add those libraries to my project
Libraries:
- PresentationCore.dll
- PresentationFramework.dll
- System.xaml.dll
- WindowsBase.dll
Error Message:
In Error List:
Object reference not set to an instance of an object. App1 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\8.2\Microsoft.Windows.UI.Xaml.Common.targets 266
In output:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\8.2\Microsoft.Windows.UI.Xaml.Common.targets(266,5): Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.
The Error in this Line (from file name Microsoft.Windows.UI.Xaml.Common.targets)
<CompileXaml
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
Language="$(Language)"
RootNamespace="$(RootNamespace)"
XamlPages="#(Page)"
XamlApplications="#(ApplicationDefinition)"
PriIndexName="$(PriIndexName)"
ProjectName="$(MsBuildProjectName)"
IsPass1="True"
CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
ProjectPath="$(MSBuildProjectFullPath)"
CIncludeDirectories="$(XamlCppIncludeDirectories)"
OutputPath="$(XamlGeneratedOutputPath)"
OutputType="$(OutputType)"
ReferenceAssemblyPaths="#(ReferenceAssemblyPaths)"
ReferenceAssemblies="#(ReferencePath)"
ForceSharedStateShutdown="False"
CompileMode="RealBuildPass1"
XAMLFingerprint="$(XAMLFingerprint)"
FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
VCInstallDir="$(VCInstallDir)"
SavedStateFile="$(XamlSavedStateFilePath)"
SuppressWarnings="$(SuppressXamlWarnings)"
TargetPlatformMinVersion="$(TargetPlatformMinVersion)"
WindowsSdkPath="$(WindowsSdkPath)"
>
I think the error from the libraries so I tired old versions from framework libraries but the same error appears.
I thought I have error in my code. So, I created an empty project. added library. Build, and same error again, So the problem is not from my code since I have no code in empty project.
My search on the internet suggests to updat both Visual studio and windows to the latest version. (I did that)
Error in my code. (it's empty new project)
So I end up with empty hands with most annoying error and no solution worked out for me for the last 10 days.
Visual Studio Community 2017
Libraries from framework V.4.6.2
PLEASE HELP
THANK YOU
Since no one answered my question and i couldn't find any solution on the internet. I found out the solution which i will post here in case some one need it in the future.
the WindowsBase.dll does not support WPF
that is why it required the xaml which will never work.
so if you need delegate.begininvoke you need to find another solution since it needs WindowsBase.dll
my friend suggested to use worker which i am tring ti do now

MvvmCross 4 and WPF SQLite plugin

In MvvmCross 4.0.0 the Community SQLite plugin has been replaced with new SQLite-PCL plugin (if I am not mistaken).
It works great in my Android application, but when I tried to use it in WPF application I faced problems.
When package is installed from nuget there's no default Bootstrap file, therefore Mvx runtime fails to resolve classes like MvxSqliteConnectionFactory.
When I add bootstrap code manually I get error like:
A first chance exception of type Cirrious.CrossCore.Exceptions.MvxException occurred in WindowsBase.dll
Version Unknown : Time 26/10/2015 08:53:16.232 PM: Error : 1.30 Exception: could not load plugin assembly for type MvvmCross.Plugins.Sqlite.PluginLoader
I figured that runtime is not able to load assembly probably because it does lookup by appending .Wpf suffix to the name of the plugin, so it looks for assembly MvvmCross.Plugins.Sqlite.Wpf or something like that. But there's no such library, in repository there's only WindowsUWP version.
What can I do to fix the problem and how do I use this plugin in WPF app?
WPF plugin added to MvvmCross repos, please check out the latest prerelease version.

how to solve the type and namespace could not be found

I am trying to make a cross platform application using MONO. i developed the project into c#(windows) and I want to run that project into Linux. For that purpose i am using MONO.But when i am running my project then I am getting error that the type and namespace could not be found.Actually I have created two partition of the project ,one is main function and other is the rest of the logic.And to access the other functionality i am using the namespace.but when i am running i am getting error
Here is the line where i am getting error in line 2 and 3
You need to pass the referenced assembly path using -pkg switch. I think you did not reference VehicleRoutPlannerCore dll while compiling.
Please refer to http://linux.die.net/man/1/mcs
you should invoke it like
mcs -pkg:path-to-VehicleRoutPlannerCore-assembly VehicleRoutingConsole.cs

Why am I getting error CS0246: The type or namespace name could not be found?

I am using Snarl C# API to send notifications to snarl.
Now I have saved the content of above url in a file named SnarlNetwork.cs and the content of my test.cs file are:
using SnarlNetworkProtocol;
using System;
class test
{
public static void Main(String[] args)
{
SNP snarl_object = new SNP();
string hostname = "localhost";
string hostport = "9887";
string appName = "Spotify";
bool val = snarl_object.register(hostname, hostport, appName);
if (val == true)
{
string title = "hello";
string message = "world";
string timeout = "5";
bool newval = snarl_object.notify(hostname, hostport, appName, null, title, message, timeout);
if (newval == true)
{
Console.WriteLine("sucessfull");
}
}
}
}
Now when I try to compile my test.cs file using csc test.cs I get the following error:
C:\Users\Noob\csharp>csc test.cs
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
test.cs(1,7): error CS0246: The type or namespace name 'SnarlNetworkProtocol' could not be found (are you missing a using directive or an assembly reference?)
So, what am I doing wrong here because according to me I am not missing any using directive.
I was using .NET Framework 4.5 but my new library had .NET Framework 4.5.2 and I got the same issue when I tried to build. I solved it by updating my project from 4.5 to 4.5.2 (same as my library).
On the Solution Explorer tab right click and select Properties
Resolve this issue by updating the Target Framework in the project application settings.
For instance, In my case the project was compiling with .net framework version 4.5.1 but the dll which were referenced were compiled with the version 4.6.1.
So have updated the my project version. I hope it works for you.
This is the problem:
C:\Users\Noob\csharp>csc test.cs
You haven't added a reference to the DLL. You need something like:
C:\Users\Noob\csharp>csc test.cs /r:SnarlNetwork.dll
(or whatever the assembly is called).
Alternatively, if you haven't got it as a separate library, just compile both files:
C:\Users\Noob\csharp>csc test.cs SnarlNetwork.cs
If you haven't compiled an assembly but want to, you can use:
csc /target:library /out:SnarlNetwork.dll SnarlNetwork.cs
csc Test.cs /r:SnarlNetwork.dll
(In fact, specifying the output file is unnecessary in this particular case, but it's still clearer...)
Edit: Oh ignore me, you're not using Visual Studio.
Have you added the reference to your project?
As in this sort of thing:
It might be due to "client profile" of the .NET Framework.
Try to use the "full version" of .NET.
This usually happens to me when I have a using statement but have forgotten to reference the assembly that defines the namespace.
But in your case, as the namespace is defined in a file in your project, you have forgotten to tell the compiler about the snarlnetwork.cs file.
See csc compiler examples
I had this error on a MVC Project. And after a long research i found out that the .cs file containing some of the classes i referenced in the main project had a Build Actions set to "Content" ...
After changing it "Content"->"Compile" the error disappeared.
most of the problems cause by .NET Framework. So just go to project properties and change .Net version same as your reference dll.
Done!!!
Hope it's help :)
I resolved this by making sure my project shared the same .Net Framework version as the projects/libraries it depended on.
It turned out the libraries (projects within the solution) used .Net 4.6.1 and my project was using 4.5.2
i also faced same problem,
Reason: why i faced this error is,
rather then creating new partial view,
i have created class and then renamed its extension from ".cs" to ".cshtml".
Solution:
Just delete that rename view and re-create proper partial/full view. it will work fine after that.
Check your Web.Config and find namespace = . you can remove or if you need it you must create new
I had the same error when used cs file was located inside project folder, but did not referenced from .csproj of parent project.
Intellisence see this file inside project folder, but compiler does not see it because of missing reference in .csproj
I have resolved this problem by adding the reference to System.Web.
I also got this error due to a missing reference.
The reason I did not notice is because Resharper offers to add a using and a reference. Adding the using succeeds (but it's highlighted grey), syntax highlighting of missing classes works (sometimes), but adding the reference fails silently.
When manually adding the reference an error pops up, explaining why adding the reference fails (circular reference). Resharper did not pass this error on to the GUI.
I had the same issue when I clone my project from Git and directly build the solution first time. Instead of that go to the local repository in file explorer and double click the solution file (.sln) solved my issue.
I had a similar problem after first pulling and starting a new solution. It was fixed in visual studio by first cleaning the project. Then restoring the packages. When I built again, there were no more type or namespace errors.
Theoretically, if the the client framework is higher than the library framework client project builds successfully. So I suggest you check the Platform Target to make sure there is no conflicts.
right mouse button project > Properties > Build and uncheck Prefer 32-bit which is available for console project only. And check both projects target the same platform.
[
In my case, just "add refence" and browser the DLL file. it works for me.
I had this issue when I first cloned my project from Git to Visual Studio. I just had to update my NuGet packages, and then I was good to go!
Project > Manage NuGet Packages... >
Then update the packages. It notified me and there was a yellow bar with a button that I pushed and it downloaded the packages!

Categories