Xaml Designer not loading - xaml-designer

today i've installed Visual Studio Community 2015 with Update 1 and when it try to load the Xaml Designer (even of a new project) it throws an exception:
An unhandled exception has occured
System.Runtime.InteropServices.COMException
The app did not start. (Exception from HRESULT: 0x8027025B)
at
Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.AppPackageNativeMethods.IApplicationActivationManager.ActivateApplication(String appUserModelId, String activationContext, ActivateOptions options, Int32& processId)
at
Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.DesignerWrtUtility.ActivateApplication(String appUserModelId, String activationContext, Object site, Boolean isRunningElevated)
at
Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.ActivateApplicationInternal(String appUserModelId, String activationContext, Object site)
at
Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateDesignerProcess(String applicationPath, String clientPort, Uri hostUri, IDictionary environmentVariables, Int32& processId, Object& processData)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, IIsolationTarget isolationTarget, String baseDirectory)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
at
Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.Initialize()
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()
at
Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget, IObjectCatalog catalog)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry, IServiceProvider serviceOverrides)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func'2 func, CancellationToken cancelToken)
at
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.<>c__DisplayClass10_0'1.b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

I had the same problem, this fixed it:
uninstall Visual Studio
uninstall all Windows SDKs/Emulators
install everything again
After that everything worked fine again.

If you're using an HP:
Delete the "Platform" environment variable in Control Panel > System > Advanced System Settings > Environment Variables [...] =HPD. (source)
If you're not using an HP, try following these steps:
Close any instance of Visual Studio
Open Visual Studio and create a new C# UWP empty project (name it whatever you want)
Run the newly created "useless" project, then close it as Visual Studio
Re-open your previous project. (source)
If you recently upgraded to the Windows 10 SDK from 10240 to 10586, then try setting the project Properties > Application > "Target version" to Windows 10 (10.0; Build 10240). (source)
Let me know if this helps!

Related

Unable to load shared library 'urlmon.dll' on linux environment

ASP .NET Core 3.1
System.DllNotFoundException: Unable to load shared library 'urlmon.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liburlmon.dll: cannot open shared object file: No such file or directory
at FindMimeFromData(IntPtr pBC, String pwzUrl, Byte[] pBuffer, Int32 cbSize, String pwzMimeProposed, Int32 dwMimeFlags, IntPtr& ppwzMimeOut, Int32 dwReserved)
at ValidateMimeType(List`1 colBytesFile, htconstructorparams htConstructorParams) in \Share.cs:line 5048
at ValidateFileMimeType(HttpRequest request, htconstructorparams htConstructorParams) in \Share.cs:line 5019
at FileMiddleware.Invoke(HttpContext context) in ''\FileMiddleware.cs:line 43
at JwtMiddleware.Invoke(HttpContext context, IUserSessionService _userSessionService) in ''\JwtMiddleware.cs:line 79
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at ErrorHandlerMiddleware.Invoke(HttpContext context, hk_log_dbcontext logDbContext)
urlmon.dll is a Windows component.
ASP.NET Core is cross-platform, but when you run it on Linux, you can't access any libraries, features or files that are Windows specific, such as urlmon.dll.
If you want to find out the mime type of a file on Linux, you might have to use a Linux-specific solution such as How can I find out a file's MIME type (Content-Type)?.

Xamarin Forms Emulator not working after release

I created an apk file and installed into my device. Afterwards, I try running my emulator on visual studio but it does not work anymore. It kept showing me errors. Does anyone know how to solve this issue?
Severity Code Description Project File Line Suppression State
Error
Mono.Linker.MarkException: Error processing method: 'System.Void Xfx.Controls.Droid.Renderers.XfxCardViewRendererDroid::Xamarin.Forms.Platform.Android.IVisualElementRenderer.add_LayoutChange(System.EventHandler`1<Android.Views.View/LayoutChangeEventArgs>)' in assembly: 'Xfx.Controls.Droid.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Xamarin.Forms.Platform.Android.IVisualElementRenderer::add_LayoutChange(System.EventHandler`1<Android.Views.View/LayoutChangeEventArgs>)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
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 MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute() iSmart_ProductionApp.Android

Error in running default Web Application .Net Core 3

I am choosing Empty template while creating a new asp.net core web application (.net core 3) as a option.
When I run project, I face with this error
System.TypeInitializationException: 'The type initializer for 'Microsoft.Extensions.Logging.EventSource.LoggingEventSource' threw an exception.'
Stack Trace:
at Microsoft.Extensions.Hosting.Host.<>c.<CreateDefaultBuilder>b__1_2(HostBuilderContext hostingContext, ILoggingBuilder logging)
at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass4_1.<ConfigureLogging>b__1(ILoggingBuilder builder)
at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action`1 configure)
at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass4_0.<ConfigureLogging>b__0(HostBuilderContext context, IServiceCollection collection)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at WebApplication2.Program.Main(String[] args) in D:\WebApplication2\WebApplication2\Program.cs:line 16
Stack Trace in Inner Exception:
at System.Globalization.CompareInfo.CompareString(ReadOnlySpan`1 string1, ReadOnlySpan`1 string2, CompareOptions options)
at System.Globalization.CompareInfo.Compare(String string1, String string2, CompareOptions options)
at System.Globalization.TextInfo.PopulateIsAsciiCasingSameAsInvariant()
at System.Globalization.TextInfo.ChangeCaseCommon[TConversion](String source)
at System.Globalization.TextInfo.ToUpper(String str)
at System.String.ToUpperInvariant()
at System.Diagnostics.Tracing.EventSource.GetGuid(Type eventSourceType)
at System.Diagnostics.Tracing.EventSource..ctor(EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(EventSourceSettings settings)
at Microsoft.Extensions.Logging.EventSource.LoggingEventSource..cctor()
What is this and how can I resolve it.
Thanks.
The problem was solved for me when I run the application on IIS instead of IIS Express.

InvalidProgramException when trying to parse VB.Net code with Roslyn

I'm trying to parse VB.Net code using Roslyn, but it keeps throwing the InvalidProgramException (Jit compiler encountered a limitation..). A similar code works perfectly with C#.
This is my code:
var source = "Public Module Module1 \r\n Public Sub X() \r\n End Sub \r\n End Module";
var syntaxTree = Roslyn.Compilers.VisualBasic.SyntaxTree.ParseText(source);
var compilation = Roslyn.Compilers.VisualBasic.Compilation.Create("MyCompilation", syntaxTrees: new[] {syntaxTree});
var semanticModel = compilation.GetSemanticModel(syntaxTree);
The exception is thrown on the last line.
Update Here's the stack trace:
System.InvalidProgramException: JIT Compiler encountered an internal limitation.
HResult: -2146233030
в Roslyn.Compilers.VisualBasic.SeparatedSyntaxList`1..ctor(SyntaxNode node, Int32 index)
в Roslyn.Compilers.VisualBasic.CompilationUnitSyntax.get_Members()
в Roslyn.Compilers.VisualBasic.DeclarationTreeBuilder.VisitCompilationUnit(CompilationUnitSyntax node)
в Roslyn.Compilers.VisualBasic.CompilationUnitSyntax.Accept[TResult](SyntaxVisitor`1 visitor)
в Roslyn.Compilers.VisualBasic.SyntaxVisitor`1.Visit(SyntaxNode node)
в Roslyn.Compilers.VisualBasic.DeclarationTreeBuilder.ForDeclaration(SyntaxNode node)
в Roslyn.Compilers.VisualBasic.DeclarationTreeBuilder.ForTree(SyntaxTree tree, ReadOnlyArray`1 rootNamespace, String scriptClassName, Boolean isSubmission)
в Roslyn.Compilers.VisualBasic.Compilation.ForTree(SyntaxTree tree, CompilationOptions options, Boolean isSubmission)
в Roslyn.Compilers.VisualBasic.Compilation._Closure$__11._Lambda$__59()
в System.Lazy`1.CreateValue()
в System.Lazy`1.LazyInitValue()
в System.Lazy`1.get_Value()
в Roslyn.Compilers.VisualBasic.DeclarationTable.GetLatestRootDeclarationIfAny(Boolean includeEmbedded)
в Roslyn.Compilers.VisualBasic.DeclarationTable.GetMergedReferenceDirectives()
в System.Lazy`1.CreateValue()
в System.Lazy`1.LazyInitValue()
в System.Lazy`1.get_Value()
в Roslyn.Compilers.VisualBasic.DeclarationTable.get_ReferenceDirectives()
в Roslyn.Compilers.VisualBasic.Compilation.get_ReferenceDirectives()
в Roslyn.Compilers.CommonAssemblyManager`3.GetCompilationReferences(TCompilation compilation, DiagnosticBag diagnostics, List`1 references, IDictionary`2& boundReferenceDirectives, List`1& referenceDirectiveLocations)
в Roslyn.Compilers.CommonAssemblyManager`3.ResolveMetadataReferences(TCompilation compilation, List`1 references, IDictionary`2& boundReferenceDirectiveMap, ReadOnlyArray`1& boundReferenceDirectives, List`1 assemblies, List`1 modules, DiagnosticBag diagnostics)
в Roslyn.Compilers.VisualBasic.Compilation.AssemblyManager.CreateSourceAssemblyForCompilation(Compilation compilation, Dictionary`2& referencedAssembliesMap, Dictionary`2& referencedModulesMap, IDictionary`2& boundReferenceDirectiveMap, ReadOnlyArray`1& boundReferenceDirectives, SourceAssemblySymbol& assemblySymbol, DiagnosticBag& diagnostics)
в Roslyn.Compilers.VisualBasic.Compilation.AssemblyManager.CreateSourceAssemblyForCompilation(Compilation compilation)
в Roslyn.Compilers.VisualBasic.Compilation.EnsureSourceAssemblyCreated()
в Roslyn.Compilers.VisualBasic.Compilation.get_SourceAssembly()
в Roslyn.Compilers.VisualBasic.Compilation.get_Assembly()
в Roslyn.Compilers.VisualBasic.Compilation.get_SourceModule()
в Roslyn.Compilers.VisualBasic.Compilation.GetSemanticModel(SyntaxTree syntaxTree)
This exception typically indicates that the program itself is corrupt. If you're able to provide a crash dump file, please do so.
Also, verify that your assemblies haven't been corrupted in some way. All Roslyn binaries we ship are digitially signed, so check if your Roslyn.Compilers.VisualBasic.dll has a valid signature. Find the DLL, go under File Properties in Windows Explorer, Digital Signatures tab, and hit details. Verify you see "the signature is OK."
It turned out that the exception is being thrown when I use the code on my Web site only, and then the Web site runs on either VisualStudio Development Server or IIS Express. Also running it via TestDriven.net and Gallio (might be just old versions). The code runs fine with a Console app or IIS full.
I still consider this a bug, since a similar code that uses the CSharp compiler runs just fine.

DLL Pinvoke with Windows Mobile C++ libraries porting to C#

I am trying to use OpenCV as here, and I am stuck at one moment where I get PInvoke, namely:
my DLL.cpp
#define DLL_API __declspec(dllexport)
//...
DLL_API short processImage(const char* in_file, const char * out_file)
//...
my form.cs
[DllImport("DLL", EntryPoint = "processImage")]
private static extern short _ProcessImage(byte[] in_file, byte[] out_file);
public static short binarizeImage(string in_file, string out_file)
{
return _ProcessImage(StringToASCIIByteArray(in_file), StringToASCIIByteArray(out_file));
}
public static byte[] StringToASCIIByteArray(string str)
{
return Encoding.ASCII.GetBytes(str + "\0");
}
I think that this might be a problem with target architecture (in my VS 2008 project). When I use 'Any CPU' it compiles & runs but throws Pinvoke, when I set it to 'Windows Mobile 6 Professional SDK (ARMV4I)' it compiles but doesn't want to deploy and I got this in output window:
1>------ Deploy started: Project: DLL, Configuration: Debug Windows Mobile 6 Professional SDK (ARMV4I) ------
1>The system cannot find the path specified.
1>
2>------ Deploy started: Project: smartDeviceOcr, Configuration: Debug Any CPU ------
2>Deploying 'D:\VS 2008 Projects\C++\SmartDevice\ocr\smartDeviceOcr\bin\Debug\smartDeviceOcr.exe'
========== Deploy: 1 succeeded, 1 failed, 0 skipped ==========
Does the specific ARMV4I matter ? I have ARM920T on my mobile. Can/should I edit this to make it work ?
EDIT:
Just to be clear the Pinvoke points to :
return _ProcessImage(StringToASCIIByteArray(in_file), StringToASCIIByteArray(out_file));
and the exception message is :
System.MissingMethodException was unhandled
Message="Cannot find the library DLL PInvoke 'DLL'."
StackTrace:
in smartDeviceOcr.Form1.binarizeImage(String in_file, String out_file)
in smartDeviceOcr.Form1.button1_Click(Object sender, EventArgs e)
in System.Windows.Forms.Control.OnClick(EventArgs e)
in System.Windows.Forms.Button.OnClick(EventArgs e)
in System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)
in System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
in Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
in System.Windows.Forms.Application.Run(Form fm)
in smartDeviceOcr.Program.Main()
EDIT2:
Ok now it's really strange. I have changed few things. I have added the openCV's dlls to the deployment list in the project properties so that I can see that they are being copied on deployment and I have copied manually all the dlls to exe directory on the PC.
I have also changed some of the deployment options in DLL project so that the dlls are copied to the proper directory (automatically) on the phone and ....
now I have the error on runtime (when trying to access the function from the dll - opencv) :
The remote connection to the device has been lost
As I don't see any answers I post my answer (although I still have problems with this)
The problem can be solved by adding directories to which dlls should be deployed to:
Project-> Properties -> Deployment -> Remote Directory
and properly specify files in:
Project-> Properties -> Deployment -> Additional Files
as like
highgui200.dll|$(SolutionDir)\opencv_winmo\dll|%CSIDL_PROGRAM_FILES%\smartDeviceOcr|0
cv200.dll|$(SolutionDir)\opencv_winmo\dll|%CSIDL_PROGRAM_FILES%\smartDeviceOcr|0
cxcore200.dll|$(SolutionDir)\opencv_winmo\dll|%CSIDL_PROGRAM_FILES%\smartDeviceOcr|0
ml200.dll|$(SolutionDir)\opencv_winmo\dll|%CSIDL_PROGRAM_FILES%\smartDeviceOcr|0
msvcr90.dll|$(BINDIR)\$(INSTRUCTIONSET)\|%CSIDL_PROGRAM_FILES%\smartDeviceOcr|0